jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r933662 - in /jackrabbit/branches/2.1: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/ItemStateHierarchyManagerDeadlockTest.java
Date Tue, 13 Apr 2010 15:00:05 GMT
Author: jukka
Date: Tue Apr 13 15:00:04 2010
New Revision: 933662

URL: http://svn.apache.org/viewvc?rev=933662&view=rev
Log:
2.1: Merged revision 933646 (JCR-2525)

Added:
    jackrabbit/branches/2.1/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/ItemStateHierarchyManagerDeadlockTest.java
      - copied unchanged from r933646, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/daily/ItemStateHierarchyManagerDeadlockTest.java
Modified:
    jackrabbit/branches/2.1/   (props changed)
    jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java

Propchange: jackrabbit/branches/2.1/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Apr 13 15:00:04 2010
@@ -2,4 +2,4 @@
 /jackrabbit/sandbox/JCR-1456:774917-886178
 /jackrabbit/sandbox/JCR-2170:812417-816332
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216
+/jackrabbit/trunk:931121,931479,931483-931484,931504,931609,931613,931838,931919,932318-932319,933144,933197,933203,933213,933216,933554,933646

Modified: jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=933662&r1=933661&r2=933662&view=diff
==============================================================================
--- jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/branches/2.1/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Tue Apr 13 15:00:04 2010
@@ -320,9 +320,12 @@ public class NodeState extends ItemState
      * @param id the id the new entry is refering to.
      * @return the newly added <code>ChildNodeEntry</code>
      */
-    public synchronized ChildNodeEntry addChildNodeEntry(Name nodeName,
+    public ChildNodeEntry addChildNodeEntry(Name nodeName,
                                                          NodeId id) {
-        ChildNodeEntry entry = childNodeEntries.add(nodeName, id);
+        ChildNodeEntry entry = null;
+        synchronized (this) {
+            entry = childNodeEntries.add(nodeName, id);
+        }
         notifyNodeAdded(entry);
         return entry;
     }
@@ -336,12 +339,18 @@ public class NodeState extends ItemState
      * @return <code>true</code> if the entry was sucessfully renamed;
      *         otherwise <code>false</code>
      */
-    public synchronized boolean renameChildNodeEntry(Name oldName, int index,
+    public boolean renameChildNodeEntry(Name oldName, int index,
                                                      Name newName) {
-        ChildNodeEntry oldEntry = childNodeEntries.remove(oldName, index);
-        if (oldEntry != null) {
-            ChildNodeEntry newEntry =
+        ChildNodeEntry oldEntry = null;
+        ChildNodeEntry newEntry = null;
+        synchronized (this) {
+            oldEntry = childNodeEntries.remove(oldName, index);
+            if (oldEntry != null) {
+                newEntry =
                     childNodeEntries.add(newName, oldEntry.getId());
+            }
+        }
+        if (oldEntry != null) {
             notifyNodeAdded(newEntry);
             notifyNodeRemoved(oldEntry);
             return true;
@@ -357,8 +366,11 @@ public class NodeState extends ItemState
      * @return <code>true</code> if the specified child node entry was found
      *         in the list of child node entries and could be removed.
      */
-    public synchronized boolean removeChildNodeEntry(Name nodeName, int index) {
-        ChildNodeEntry entry = childNodeEntries.remove(nodeName, index);
+    public boolean removeChildNodeEntry(Name nodeName, int index) {
+        ChildNodeEntry entry = null;
+        synchronized (this) {
+            entry = childNodeEntries.remove(nodeName, index);
+        }
         if (entry != null) {
             notifyNodeRemoved(entry);
         }
@@ -372,8 +384,11 @@ public class NodeState extends ItemState
      * @return <code>true</code> if the specified child node entry was found
      *         in the list of child node entries and could be removed.
      */
-    public synchronized boolean removeChildNodeEntry(NodeId id) {
-        ChildNodeEntry entry = childNodeEntries.remove(id);
+    public boolean removeChildNodeEntry(NodeId id) {
+        ChildNodeEntry entry = null;
+        synchronized (this) {
+            entry = childNodeEntries.remove(id);    
+        }
         if (entry != null) {
             notifyNodeRemoved(entry);
         }
@@ -383,8 +398,10 @@ public class NodeState extends ItemState
     /**
      * Removes all <code>ChildNodeEntry</code>s.
      */
-    public synchronized void removeAllChildNodeEntries() {
-        childNodeEntries.removeAll();
+    public void removeAllChildNodeEntries() {
+        synchronized (this) {
+            childNodeEntries.removeAll();
+        }
         notifyNodesReplaced();
     }
 
@@ -394,15 +411,16 @@ public class NodeState extends ItemState
      * @param nodeEntries list of {@link ChildNodeEntry} or
      * a {@link ChildNodeEntries} list.
      */
-    public synchronized void setChildNodeEntries(List<ChildNodeEntry> nodeEntries)
{
-        if (nodeEntries instanceof ChildNodeEntries) {
-            // optimization
-            ChildNodeEntries entries = (ChildNodeEntries) nodeEntries;
-            childNodeEntries = (ChildNodeEntries) entries.clone();
-        } else {
-            childNodeEntries.removeAll();
-            childNodeEntries.addAll(nodeEntries);
-
+    public void setChildNodeEntries(List<ChildNodeEntry> nodeEntries) {
+        synchronized (this) {
+            if (nodeEntries instanceof ChildNodeEntries) {
+                // optimization
+                ChildNodeEntries entries = (ChildNodeEntries) nodeEntries;
+                childNodeEntries = (ChildNodeEntries) entries.clone();
+            } else {
+                childNodeEntries.removeAll();
+                childNodeEntries.addAll(nodeEntries);
+            }
         }
         notifyNodesReplaced();
     }



Mime
View raw message