mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 06:24:43 +00:00
[1.18.x] Make Util.memoize thread-safe (#9166)
* Make Util.memoize thread-safe * Add the forge marker present in the PR
This commit is contained in:
1 parent
84b1a40fe2
commit
f7c4320b7f
1 file changed
+10
@@ -19,3 +19,13 @@
|
||||
if (SharedConstants.f_136183_) {
|
||||
throw illegalargumentexception;
|
||||
}
|
||||
@@ -649,7 +_,8 @@
|
||||
|
||||
public static <T, R> Function<T, R> m_143827_(final Function<T, R> p_143828_) {
|
||||
return new Function<T, R>() {
|
||||
- private final Map<T, R> f_143852_ = Maps.newHashMap();
|
||||
+ // FORGE: Allow using memoized functions from multiple threads.
|
||||
+ private final Map<T, R> f_143852_ = Maps.newConcurrentMap();
|
||||
|
||||
public R apply(T p_211578_) {
|
||||
return this.f_143852_.computeIfAbsent(p_211578_, p_143828_);
|
||||
Reference in new issue
Block a user