openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1455189 - /openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Date Mon, 11 Mar 2013 15:39:52 GMT
Author: curtisr7
Date: Mon Mar 11 15:39:51 2013
New Revision: 1455189

URL: http://svn.apache.org/r1455189
Log:
OPENJPA-2346 : Minor performance improvement to MetaDataRepository. Merged from trunk.

Modified:
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=1455189&r1=1455188&r2=1455189&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Mon Mar 11 15:39:51 2013
@@ -39,8 +39,8 @@ import org.apache.openjpa.conf.OpenJPACo
 import org.apache.openjpa.enhance.DynamicPersistenceCapable;
 import org.apache.openjpa.enhance.PCEnhancer;
 import org.apache.openjpa.enhance.PCRegistry;
-import org.apache.openjpa.enhance.PersistenceCapable;
 import org.apache.openjpa.enhance.PCRegistry.RegisterClassListener;
+import org.apache.openjpa.enhance.PersistenceCapable;
 import org.apache.openjpa.event.LifecycleEventManager;
 import org.apache.openjpa.lib.conf.Configurable;
 import org.apache.openjpa.lib.conf.Configuration;
@@ -393,6 +393,8 @@ public class MetaDataRepository implemen
     }
 
     private ClassMetaData getMetaDataInternal(Class<?> cls, ClassLoader envLoader,
boolean mustExist) {
+        ClassMetaData meta = getMetaDataInternal(cls, envLoader);
+        if (meta == null) {
             if (cls != null && DynamicPersistenceCapable.class.isAssignableFrom(cls))
                 cls = cls.getSuperclass();
 
@@ -400,20 +402,20 @@ public class MetaDataRepository implemen
             // to locate metadata
             if (cls != null && _implGen != null && _implGen.isImplType(cls))
                 cls = _implGen.toManagedInterface(cls);
+            meta = getMetaDataInternal(cls, envLoader);
+        }
+        if (meta == null && mustExist) {
+            if (cls != null && !ImplHelper.isManagedType(_conf, cls))
+                throw new MetaDataException(_loc.get("no-meta-notpc", cls)).setFatal(false);
 
-            ClassMetaData meta = getMetaDataInternal(cls, envLoader);
-            if (meta == null && mustExist) {
-                if (cls != null && !ImplHelper.isManagedType(_conf, cls))
-                    throw new MetaDataException(_loc.get("no-meta-notpc", cls)).setFatal(false);
-
-                Set<String> pcNames = getPersistentTypeNames(false, envLoader);
-                if (pcNames != null && pcNames.size() > 0)
-                    throw new MetaDataException(_loc.get("no-meta-types", cls, pcNames));
+            Set<String> pcNames = getPersistentTypeNames(false, envLoader);
+            if (pcNames != null && pcNames.size() > 0)
+                throw new MetaDataException(_loc.get("no-meta-types", cls, pcNames));
 
-                throw new MetaDataException(_loc.get("no-meta", cls));
-            }
-            resolve(meta);
-            return meta;
+            throw new MetaDataException(_loc.get("no-meta", cls));
+        }
+        resolve(meta);
+        return meta;
     }
 
     /**
@@ -1919,8 +1921,8 @@ public class MetaDataRepository implemen
 
     public void endConfiguration() {
         initializeMetaDataFactory();
-        if (_implGen == null)
-            _implGen = new InterfaceImplGenerator(this);
+		if (_implGen == null)
+			_implGen = new InterfaceImplGenerator(this);
         if (_preload == true) {
             _oids = new HashMap<Class<?>, Class<?>>();
             _impls = new HashMap<Class<?>, Collection<Class<?>>>();



Mime
View raw message