Revert "Make sure that same classloaders get same weak ref"

This reverts commit 50793e5244.
This commit is contained in:
Nikolay Martynov 2020-02-25 21:47:42 +01:00
parent 50793e5244
commit 82dd2aa1b3
1 changed files with 4 additions and 7 deletions

View File

@ -82,14 +82,11 @@ public class DDCachingPoolStrategy implements PoolStrategy {
return createCachingTypePool(bootstrapCacheProvider, classFileLocator); return createCachingTypePool(bootstrapCacheProvider, classFileLocator);
} }
WeakReference<ClassLoader> loaderRef; WeakReference<ClassLoader> loaderRef = loaderRefCache.getIfPresent(classLoader);
synchronized (loaderRefCache) {
loaderRef = loaderRefCache.getIfPresent(classLoader);
if (loaderRef == null) { if (loaderRef == null) {
loaderRef = new WeakReference<>(classLoader); loaderRef = new WeakReference<>(classLoader);
loaderRefCache.put(classLoader, loaderRef); loaderRefCache.put(classLoader, loaderRef);
}
} }
final int loaderHash = classLoader.hashCode(); final int loaderHash = classLoader.hashCode();