Index: E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java
===================================================================
--- E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java	(revision 86764)
+++ E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/LocalItemStateManager.java	(working copy)
@@ -56,6 +56,11 @@
      * Change log
      */
     private final ChangeLog changeLog = new ChangeLog();
+    
+    /**
+     * Cache monitor object
+     */
+    private final Object cacheMonitor = new Object();
 
     /**
      * State change dispatcher.
@@ -548,4 +553,8 @@
     public void nodeRemoved(NodeState state, Name name, int index, NodeId id) {
         dispatcher.notifyNodeRemoved(state, name, index, id);
     }
+
+	public Object getCacheMonitorObject() {
+		return cacheMonitor;
+	}
 }


Index: E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateListener.java
===================================================================
--- E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateListener.java	(revision 86764)
+++ E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeStateListener.java	(working copy)
@@ -64,4 +64,6 @@
      * @param id    id of removed node
      */
     void nodeRemoved(NodeState state, Name name, int index, NodeId id);
+    
+    Object getCacheMonitorObject();
 }


Index: E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
===================================================================
--- E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java	(revision 86764)
+++ E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java	(working copy)
@@ -296,8 +296,10 @@
      * @return the <code>ChildNodeEntry</code> with the specified name and index
      *         or <code>null</code> if there's no matching entry.
      */
-    public synchronized ChildNodeEntry getChildNodeEntry(Name nodeName, int index) {
-        return childNodeEntries.get(nodeName, index);
+    public ChildNodeEntry getChildNodeEntry(Name nodeName, int index) {
+    	synchronized (getLockObject()) {
+    		return childNodeEntries.get(nodeName, index);
+    	}
     }
 
     /**
@@ -310,8 +312,10 @@
      * @see #addChildNodeEntry
      * @see #removeChildNodeEntry
      */
-    public synchronized ChildNodeEntry getChildNodeEntry(NodeId id) {
-        return childNodeEntries.get(id);
+    public ChildNodeEntry getChildNodeEntry(NodeId id) {
+    	synchronized (getLockObject()) {
+    		return childNodeEntries.get(id);
+    	}
     }
 
     /**
@@ -322,8 +326,10 @@
      * @see #addChildNodeEntry
      * @see #removeChildNodeEntry
      */
-    public synchronized List getChildNodeEntries() {
-        return childNodeEntries;
+    public List getChildNodeEntries() {
+    	synchronized (getLockObject()) {
+    		return childNodeEntries;
+    	}
     }
 
     /**
@@ -345,11 +351,13 @@
      * @param id the id the new entry is refering to.
      * @return the newly added <code>ChildNodeEntry</code>
      */
-    public synchronized ChildNodeEntry addChildNodeEntry(Name nodeName,
-                                                         NodeId id) {
-        ChildNodeEntry entry = childNodeEntries.add(nodeName, id);
-        notifyNodeAdded(entry);
-        return entry;
+    public ChildNodeEntry addChildNodeEntry(Name nodeName,
+                                                NodeId id) {
+    	synchronized (getLockObject()) {
+	        ChildNodeEntry entry = childNodeEntries.add(nodeName, id);
+	        notifyNodeAdded(entry);
+	        return entry;
+    	}
     }
 
     /**
@@ -361,17 +369,19 @@
      * @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 =
-                    childNodeEntries.add(newName, oldEntry.getId());
-            notifyNodeAdded(newEntry);
-            notifyNodeRemoved(oldEntry);
-            return true;
+        synchronized (getLockObject()) {
+	    	ChildNodeEntry oldEntry = childNodeEntries.remove(oldName, index);
+	        if (oldEntry != null) {
+	            ChildNodeEntry newEntry =
+	                    childNodeEntries.add(newName, oldEntry.getId());
+	            notifyNodeAdded(newEntry);
+	            notifyNodeRemoved(oldEntry);
+	            return true;
+	        }
+	        return false;
         }
-        return false;
     }
 
     /**
@@ -382,12 +392,14 @@
      * @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);
-        if (entry != null) {
-            notifyNodeRemoved(entry);
-        }
-        return entry != null;
+    public boolean removeChildNodeEntry(Name nodeName, int index) {
+    	synchronized (getLockObject()) {
+	        ChildNodeEntry entry = childNodeEntries.remove(nodeName, index);
+	        if (entry != null) {
+	            notifyNodeRemoved(entry);
+	        }
+	        return entry != null;
+    	}
     }
 
     /**
@@ -397,20 +409,24 @@
      * @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);
-        if (entry != null) {
-            notifyNodeRemoved(entry);
-        }
-        return entry != null;
+    public boolean removeChildNodeEntry(NodeId id) {
+    	synchronized (getLockObject()) {
+	    	ChildNodeEntry entry = childNodeEntries.remove(id);
+	        if (entry != null) {
+	            notifyNodeRemoved(entry);
+	        }
+	        return entry != null;
+    	}
     }
 
     /**
      * Removes all <code>ChildNodeEntry</code>s.
      */
-    public synchronized void removeAllChildNodeEntries() {
-        childNodeEntries.removeAll();
-        notifyNodesReplaced();
+    public void removeAllChildNodeEntries() {
+    	synchronized (getLockObject()) {
+	        childNodeEntries.removeAll();
+	        notifyNodesReplaced();
+    	}
     }
 
     /**
@@ -419,17 +435,19 @@
      * @param nodeEntries list of {@link ChildNodeEntry} or
      * a {@link ChildNodeEntries} list.
      */
-    public synchronized void setChildNodeEntries(List nodeEntries) {
-        if (nodeEntries instanceof ChildNodeEntries) {
-            // optimization
-            ChildNodeEntries entries = (ChildNodeEntries) nodeEntries;
-            childNodeEntries = (ChildNodeEntries) entries.clone();
-        } else {
-            childNodeEntries.removeAll();
-            childNodeEntries.addAll(nodeEntries);
-
-        }
-        notifyNodesReplaced();
+    public void setChildNodeEntries(List nodeEntries) {
+    	synchronized (getLockObject()) {
+	        if (nodeEntries instanceof ChildNodeEntries) {
+	            // optimization
+	            ChildNodeEntries entries = (ChildNodeEntries) nodeEntries;
+	            childNodeEntries = (ChildNodeEntries) entries.clone();
+	        } else {
+	            childNodeEntries.removeAll();
+	            childNodeEntries.addAll(nodeEntries);
+	
+	        }
+	        notifyNodesReplaced();
+    	}
     }
 
     /**
@@ -901,4 +919,14 @@
             listener.nodeRemoved(this, removed.getName(), removed.getIndex(), removed.getId());
         }
     }
+    
+    private Object getLockObject() {
+    	Object lock;
+    	if (listener != null) {
+    		lock = listener.getCacheMonitorObject();
+    	} else { 
+    		lock = childNodeEntries;
+    	}
+    	return lock;
+    }
 }


Index: E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
===================================================================
--- E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java	(revision 86764)
+++ E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java	(working copy)
@@ -84,6 +84,11 @@
      * State change dispatcher.
      */
     private final transient StateChangeDispatcher dispatcher = new StateChangeDispatcher();
+    
+    /**
+     * Cache monitor object
+     */
+    private final Object cacheMonitor = new Object();
 
     /**
      * Creates a new <code>SessionItemStateManager</code> instance.
@@ -1031,4 +1036,8 @@
             return false;
         }
     }
+
+	public Object getCacheMonitorObject() {
+		return cacheMonitor;
+	}
 }


Index: E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
===================================================================
--- E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java	(revision 86764)
+++ E:/AxS/AXS_Code/thirdparty/javacontentrepo/jackrabbit-1.6.0_idm1.1.1b/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java	(working copy)
@@ -980,4 +980,8 @@
             return id.toString();
         }
     }
+
+	public Object getCacheMonitorObject() {
+		return cacheMonitor;
+	}
 }


