openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r781221 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa: enhance/Reflection.java kernel/AbstractBrokerFactory.java
Date Wed, 03 Jun 2009 00:20:03 GMT
Author: allee8285
Date: Wed Jun  3 00:20:03 2009
New Revision: 781221

URL: http://svn.apache.org/viewvc?rev=781221&view=rev
Log:
OPENJPA-1113 - Close off memory leak.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java?rev=781221&r1=781220&r2=781221&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/enhance/Reflection.java
Wed Jun  3 00:20:03 2009
@@ -24,10 +24,8 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.security.AccessController;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
@@ -103,26 +101,6 @@
         beanPropertiesNameCache.clear();
     }
     
-    public static void flushCaches(Collection<ClassLoader> loaders) {
-        if (loaders.size() > 0) {
-            flushCache(loaders, getterMethodCache);
-            flushCache(loaders, setterMethodCache);
-            flushCache(loaders, beanPropertiesNameCache);
-        }
-    }
-
-    private static void flushCache(Collection<ClassLoader> loaders,
-        Map<Class<?>, ?> cache) {
-        for (Iterator<Class<?>> itr = cache.keySet().iterator(); 
-            itr.hasNext();) {
-            Class<?> cls = itr.next();
-            ClassLoader sLoader = cls.getClassLoader();
-            if (loaders.contains(sLoader)) {
-                itr.remove();
-            }
-        }
-    }
-
     /**
      * Return the getter method matching the given property name, optionally
      * throwing an exception if none.
@@ -132,19 +110,18 @@
         if (m != null) {
             return m;
         }
-        prop = StringUtils.capitalize(prop);
-        String name = "get" + prop;
+        String capProp = StringUtils.capitalize(prop);
         try {
             // this algorithm searches for a get<prop> or is<prop> method in
             // a breadth-first manner.
             for (Class c = cls; c != null && c != Object.class;
                 c = c.getSuperclass()) {
-                m = getDeclaredMethod(c, name, null);
+                m = getDeclaredMethod(c, "get" + capProp, null);
                 if (m != null) {
                     setGetterMethod(cls, prop, m);
                     return m;
                 } else {
-                    m = getDeclaredMethod(c, "is" + prop, null);
+                    m = getDeclaredMethod(c, "is" + capProp, null);
                     if (m != null && (m.getReturnType() == boolean.class
                         || m.getReturnType() == Boolean.class)) {
                         setGetterMethod(cls, prop, m);

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java?rev=781221&r1=781220&r2=781221&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AbstractBrokerFactory.java
Wed Jun  3 00:20:03 2009
@@ -411,7 +411,7 @@
                 PCRegistry.removeRegisterClassListener
                     (_conf.getMetaDataRepositoryInstance());
             }
-            Reflection.flushCaches(_pcClassLoaders);
+            Reflection.flushCaches();
             _conf.close();
             _closed = true;
             Log log = _conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);



Mime
View raw message