openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1737411 - /openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Date Fri, 01 Apr 2016 15:50:32 GMT
Author: hthomann
Date: Fri Apr  1 15:50:32 2016
New Revision: 1737411

URL: http://svn.apache.org/viewvc?rev=1737411&view=rev
Log:
OPENJPA-2636: Updated a Map in Configurations to avoid a ClassLoader leak.  Ported 2.2.x changes
to trunk.

Modified:
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java?rev=1737411&r1=1737410&r2=1737411&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
Fri Apr  1 15:50:32 2016
@@ -196,7 +196,9 @@ public class Configurations {
         Object key = loader == null ? NULL_LOADER : loader;
         Map<String,Class<?>> loaderCache = (Map<String,Class<?>>)
_loaders.get(key);
         if (loaderCache == null) { // We don't have a cache for this loader.
-            loaderCache = new ConcurrentHashMap<String,Class<?>>();
+            //OPENJPA-2636: Changed to HARD/WEAK to avoid Classloader leak:
+            loaderCache = new ConcurrentReferenceHashMap(ConcurrentReferenceHashMap.HARD,
+                    ConcurrentReferenceHashMap.WEAK);            
             _loaders.put(key, loaderCache);
         } else {  // We have a cache for this loader.
             cls = (Class<?>) loaderCache.get(clsName);



Mime
View raw message