openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r934478 - /openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Date Thu, 15 Apr 2010 16:38:27 GMT
Author: curtisr7
Date: Thu Apr 15 16:38:27 2010
New Revision: 934478

URL: http://svn.apache.org/viewvc?rev=934478&view=rev
Log:
OPENJPA-1630: Synchronize when modifying MetaDataRepository._registered regardless of MetaDataRepository.Preload
setting.

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

Modified: openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java?rev=934478&r1=934477&r2=934478&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
(original)
+++ openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/MetaDataRepository.java
Thu Apr 15 16:38:27 2010
@@ -1567,12 +1567,7 @@ public class MetaDataRepository implemen
     public void register(Class<?> cls) {
         // buffer registered classes until an oid metadata request is made,
         // at which point we'll parse everything in the buffer
-        if (_locking) {
-            synchronized (_registered) {
-                _registered.add(cls);
-                registerAlias(cls);
-            }
-        } else {
+        synchronized (_registered) {
             _registered.add(cls);
             registerAlias(cls);
         }
@@ -1603,16 +1598,10 @@ public class MetaDataRepository implemen
         // copy into new collection to avoid concurrent mod errors on reentrant
         // registrations
         Class<?>[] reg;
-        if (_locking) {
-            synchronized (_registered) {
-                reg = _registered.toArray(new Class[_registered.size()]);
-                _registered.clear();
-            }
-        } else {
+		synchronized (_registered) {
             reg = _registered.toArray(new Class[_registered.size()]);
             _registered.clear();
         }
-        
 
         Collection<String> pcNames = getPersistentTypeNames(false, envLoader);
         Collection<Class<?>> failed = null;
@@ -1636,11 +1625,7 @@ public class MetaDataRepository implemen
             }
         }
         if (failed != null) {
-            if (_locking) {
-                synchronized (_registered) {
-                    _registered.addAll(failed);
-                }
-            } else {
+            synchronized (_registered) {
                 _registered.addAll(failed);
             }
         }



Mime
View raw message