cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1538373 - /cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
Date Sun, 03 Nov 2013 15:13:23 GMT
Author: aadamchik
Date: Sun Nov  3 15:13:23 2013
New Revision: 1538373

URL: http://svn.apache.org/r1538373
Log:
expanding lock scope, as 'getNode' is synchronized anyways

Modified:
    cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/BaseContext.java

Modified: cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/BaseContext.java?rev=1538373&r1=1538372&r2=1538373&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
(original)
+++ cayenne/main/trunk/framework/cayenne-core-unpublished/src/main/java/org/apache/cayenne/BaseContext.java
Sun Nov  3 15:13:23 2013
@@ -247,16 +247,8 @@ public abstract class BaseContext implem
         ObjectId id = objectFromAnotherContext.getObjectId();
 
         // first look for the ID in the local GraphManager
-        T localObject = (T) getGraphManager().getNode(id);
-        if (localObject != null) {
-            return localObject;
-        }
-
         synchronized (getGraphManager()) {
-
-            // check for race condition - the object may have appeared in the
-            // GraphManager just recently...
-            localObject = (T) getGraphManager().getNode(id);
+            T localObject = (T) getGraphManager().getNode(id);
             if (localObject != null) {
                 return localObject;
             }



Mime
View raw message