cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r449529 - in /incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access: DataRowStore.java ObjectResolver.java
Date Mon, 25 Sep 2006 00:16:06 GMT
Author: aadamchik
Date: Sun Sep 24 17:16:05 2006
New Revision: 449529

URL: http://svn.apache.org/viewvc?view=rev&rev=449529
Log:
CAY-565 - moving synchronization of "snapshots" map at the DataRowStore level.

Modified:
    incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/DataRowStore.java
    incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/ObjectResolver.java

Modified: incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/DataRowStore.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/DataRowStore.java?view=diff&rev=449529&r1=449528&r2=449529
==============================================================================
--- incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/DataRowStore.java
(original)
+++ incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/DataRowStore.java
Sun Sep 24 17:16:05 2006
@@ -269,53 +269,55 @@
         Map modified = null;
         Object eventPostedBy = null;
 
-        for (int i = 0; i < size; i++) {
-            Persistent object = (Persistent) objects.get(i);
-
-            // skip HOLLOW objects as they likely were created from partial snapshots
-            if (object.getPersistenceState() == PersistenceState.HOLLOW) {
-                continue;
-            }
+        synchronized (this) {
+            for (int i = 0; i < size; i++) {
+                Persistent object = (Persistent) objects.get(i);
+
+                // skip HOLLOW objects as they likely were created from partial snapshots
+                if (object.getPersistenceState() == PersistenceState.HOLLOW) {
+                    continue;
+                }
 
-            ObjectId oid = object.getObjectId();
+                ObjectId oid = object.getObjectId();
 
-            // add snapshots if refresh is forced, or if a snapshot is
-            // missing
+                // add snapshots if refresh is forced, or if a snapshot is
+                // missing
 
-            DataRow cachedSnapshot = (DataRow) this.snapshots.get(oid);
-            if (refresh || cachedSnapshot == null) {
+                DataRow cachedSnapshot = (DataRow) this.snapshots.get(oid);
+                if (refresh || cachedSnapshot == null) {
 
-                DataRow newSnapshot = (DataRow) snapshots.get(i);
-
-                if (cachedSnapshot != null) {
-                    // use old snapshot if no changes occurred
-                    if (object instanceof DataObject
-                            && cachedSnapshot.equals(newSnapshot)) {
-                        ((DataObject) object).setSnapshotVersion(cachedSnapshot
-                                .getVersion());
-                        continue;
+                    DataRow newSnapshot = (DataRow) snapshots.get(i);
+
+                    if (cachedSnapshot != null) {
+                        // use old snapshot if no changes occurred
+                        if (object instanceof DataObject
+                                && cachedSnapshot.equals(newSnapshot)) {
+                            ((DataObject) object).setSnapshotVersion(cachedSnapshot
+                                    .getVersion());
+                            continue;
+                        }
+                        else {
+                            newSnapshot.setReplacesVersion(cachedSnapshot.getVersion());
+                        }
                     }
-                    else {
-                        newSnapshot.setReplacesVersion(cachedSnapshot.getVersion());
+
+                    if (modified == null) {
+                        modified = new HashMap();
+                        eventPostedBy = object.getObjectContext().getGraphManager();
                     }
-                }
 
-                if (modified == null) {
-                    modified = new HashMap();
-                    eventPostedBy = object.getObjectContext().getGraphManager();
+                    modified.put(oid, newSnapshot);
                 }
-
-                modified.put(oid, newSnapshot);
             }
-        }
 
-        if (modified != null) {
-            processSnapshotChanges(
-                    eventPostedBy,
-                    modified,
-                    Collections.EMPTY_LIST,
-                    Collections.EMPTY_LIST,
-                    Collections.EMPTY_LIST);
+            if (modified != null) {
+                processSnapshotChanges(
+                        eventPostedBy,
+                        modified,
+                        Collections.EMPTY_LIST,
+                        Collections.EMPTY_LIST,
+                        Collections.EMPTY_LIST);
+            }
         }
     }
 

Modified: incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/ObjectResolver.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/ObjectResolver.java?view=diff&rev=449529&r1=449528&r2=449529
==============================================================================
--- incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/ObjectResolver.java
(original)
+++ incubator/cayenne/main/branches/STABLE-1.2/cayenne/cayenne-java/src/cayenne/java/org/objectstyle/cayenne/access/ObjectResolver.java
Sun Sep 24 17:16:05 2006
@@ -130,9 +130,7 @@
      */
     List synchronizedObjectsFromDataRows(List rows) {
         synchronized (context.getObjectStore()) {
-            synchronized (context.getObjectStore().getDataRowCache()) {
-                return objectsFromDataRows(rows);
-            }
+            return objectsFromDataRows(rows);
         }
     }
 



Mime
View raw message