openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r561970 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa: enhance/PCRegistry.java util/ImplHelper.java
Date Wed, 01 Aug 2007 21:55:52 GMT
Author: kwsutter
Date: Wed Aug  1 14:55:44 2007
New Revision: 561970

URL: http://svn.apache.org/viewvc?view=rev&rev=561970
Log:
OPENJPA-285.  I am going ahead with the integration of Kevan's patches for the two memory
leaks found in OpenJPA while testing Geronimo.  I will post more details in the Issue.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java?view=diff&rev=561970&r1=561969&r2=561970
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/PCRegistry.java
Wed Aug  1 14:55:44 2007
@@ -203,6 +203,23 @@
     }
 
     /**
+     * De-Register all metadata associated with the given ClassLoader. 
+     * Allows ClassLoaders to be garbage collected.
+     *
+     * @param cl the ClassLoader
+     */
+    public static void deRegister(ClassLoader cl) {
+        synchronized (_metas) {
+            for (Iterator i = _metas.keySet().iterator(); i.hasNext();) {
+                Class pcClass = (Class) i.next();
+                if (pcClass.getClassLoader() == cl) {
+                    _metas.remove(pcClass);
+                }
+            }
+        }
+    }
+    
+    /**
      * Returns a collection of class objects of the registered
      * persistence-capable classes.
      */

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java?view=diff&rev=561970&r1=561969&r2=561970
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java Wed
Aug  1 14:55:44 2007
@@ -39,7 +39,6 @@
 import org.apache.openjpa.lib.util.Closeable;
 import org.apache.openjpa.lib.util.ReferenceMap;
 import org.apache.openjpa.lib.util.UUIDGenerator;
-import org.apache.openjpa.lib.util.concurrent.ConcurrentHashMap;
 import org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap;
 import org.apache.openjpa.meta.ClassMetaData;
 import org.apache.openjpa.meta.FieldMetaData;
@@ -244,7 +243,8 @@
         Boolean isAssignable = null;
         Map assignableTo = (Map) _assignableTypes.get(from);
         if (assignableTo == null) { // "to" cache doesn't exist, so create it...
-            assignableTo = new ConcurrentHashMap();
+            assignableTo = new ConcurrentReferenceHashMap(ReferenceMap.WEAK,
+                    ReferenceMap.HARD);
             _assignableTypes.put(from, assignableTo);
         } else { // "to" cache exists...
             isAssignable = (Boolean) assignableTo.get(to);



Mime
View raw message