cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1553802 - /cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/map/ObjRelationship.java
Date Sat, 28 Dec 2013 10:31:33 GMT
Author: aadamchik
Date: Sat Dec 28 10:31:33 2013
New Revision: 1553802

URL: http://svn.apache.org/r1553802
Log:
CAY-1868 Select contention with multiple contexts

patch by Oleg Artyukevich

Modified:
    cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/map/ObjRelationship.java

Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/map/ObjRelationship.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/map/ObjRelationship.java?rev=1553802&r1=1553801&r2=1553802&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/map/ObjRelationship.java
(original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/map/ObjRelationship.java
Sat Dec 28 10:31:33 2013
@@ -575,8 +575,16 @@ public class ObjRelationship extends Rel
      */
     synchronized void refreshFromDeferredPath() {
         if (deferredPath != null) {
-            refreshFromPath(deferredPath, true);
-            deferredPath = null;
+            
+            synchronized(this) {
+                
+                // check if another thread just 
+                // loaded path from deferredPath
+                if (deferredPath != null){
+                    refreshFromPath(deferredPath, true);
+                    deferredPath = null;
+                }
+            }
         }
     }
 
@@ -622,8 +630,6 @@ public class ObjRelationship extends Rel
      * Rebuild a list of relationships if String relationshipPath has changed.
      */
     final void refreshFromPath(String dbRelationshipPath, boolean stripInvalid) {
-        synchronized (this) {
-
             // remove existing relationships
             dbRelationships.clear();
 
@@ -652,7 +658,6 @@ public class ObjRelationship extends Rel
 
             recalculateToManyValue();
             recalculateReadOnlyValue();
-        }
     }
 
     /**



Mime
View raw message