mirror of https://github.com/apache/openjpa.git
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.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@561970 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6128ddbc2d
commit
f61968f302
|
@ -202,6 +202,23 @@ public class PCRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.apache.openjpa.kernel.StoreManager;
|
|||
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 @@ public class ImplHelper {
|
|||
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);
|
||||
|
|
Loading…
Reference in New Issue