OPENJPA-2636: Updated a Map in Configurations to avoid a ClassLoader leak.  Ported 2.2.x changes to trunk.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1737411 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
index 18666dd..484624a 100644
--- a/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
+++ b/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
@@ -196,7 +196,9 @@
         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);