jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r984411 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: NodeImpl.java state/ItemState.java state/NodeState.java state/PropertyState.java
Date Wed, 11 Aug 2010 14:03:27 GMT
Author: stefan
Date: Wed Aug 11 14:03:26 2010
New Revision: 984411

URL: http://svn.apache.org/viewvc?rev=984411&view=rev
Log:
JCR-2707: improve performance when saving a node with a large number of child nodes (e.g.
> 10k child node entries)

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=984411&r1=984410&r2=984411&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Wed Aug 11 14:03:26 2010
@@ -796,23 +796,7 @@ public class NodeImpl extends ItemImpl i
 
         synchronized (localState) {
             // copy state from transient state:
-            // parent id's
-            localState.setParentId(transientState.getParentId());
-            // primary type
-            localState.setNodeTypeName(transientState.getNodeTypeName());
-            // mixin types
-            localState.setMixinTypeNames(transientState.getMixinTypeNames());
-            // child node entries
-            localState.setChildNodeEntries(transientState.getChildNodeEntries());
-            // property entries
-            localState.setPropertyNames(transientState.getPropertyNames());
-            // shared set
-            localState.setSharedSet(transientState.getSharedSet());
-            // modCount
-            if (localState.getModCount() != transientState.getModCount()) {
-                localState.setModCount(transientState.getModCount());
-            }
-
+            localState.copy(transientState, true);
             // make state persistent
             stateMgr.store(localState);
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java?rev=984411&r1=984410&r2=984411&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
Wed Aug 11 14:03:26 2010
@@ -140,7 +140,7 @@ public abstract class ItemState {
      * @param state source state information
      * @param syncModCount if the modCount should be synchronized.
      */
-    protected abstract void copy(ItemState state, boolean syncModCount);
+    public abstract void copy(ItemState state, boolean syncModCount);
 
     /**
      * Pull state information from overlayed state.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=984411&r1=984410&r2=984411&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
Wed Aug 11 14:03:26 2010
@@ -110,10 +110,11 @@ public class NodeState extends ItemState
         this.nodeTypeName = nodeTypeName;
     }
 
+    //-------------------------------------------------------< public methods >
     /**
      * {@inheritDoc}
      */
-    protected synchronized void copy(ItemState state, boolean syncModCount) {
+    public synchronized void copy(ItemState state, boolean syncModCount) {
         synchronized (state) {
             NodeState nodeState = (NodeState) state;
             id = nodeState.id;
@@ -130,7 +131,6 @@ public class NodeState extends ItemState
         }
     }
 
-    //-------------------------------------------------------< public methods >
     /**
      * {@inheritDoc}
      *
@@ -330,12 +330,13 @@ public class NodeState extends ItemState
     }
 
     /**
-     * Renames a new <code>ChildNodeEntry</code>.
+     * Renames a  <code>ChildNodeEntry</code> by removing the old entry and
+     * appending the new entry to the end of the list.
      *
      * @param oldName <code>Name</code> object specifying the entry's old name
      * @param index   1-based index if there are same-name child node entries
      * @param newName <code>Name</code> object specifying the entry's new name
-     * @return <code>true</code> if the entry was sucessfully renamed;
+     * @return <code>true</code> if the entry was successfully renamed;
      *         otherwise <code>false</code>
      */
     public boolean renameChildNodeEntry(Name oldName, int index,
@@ -407,19 +408,12 @@ public class NodeState extends ItemState
     /**
      * Sets the list of <code>ChildNodeEntry</code> objects denoting the
      * child nodes of this node.
-     * @param nodeEntries list of {@link ChildNodeEntry} or
-     * a {@link ChildNodeEntries} list.
+     * @param nodeEntries list of {@link ChildNodeEntry}s
      */
     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);
-            }
+            childNodeEntries.removeAll();
+            childNodeEntries.addAll(nodeEntries);
         }
         notifyNodesReplaced();
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java?rev=984411&r1=984410&r2=984411&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
Wed Aug 11 14:03:26 2010
@@ -81,7 +81,7 @@ public class PropertyState extends ItemS
     /**
      * {@inheritDoc}
      */
-    protected synchronized void copy(ItemState state, boolean syncModCount) {
+    public synchronized void copy(ItemState state, boolean syncModCount) {
         synchronized (state) {
             PropertyState propState = (PropertyState) state;
             id = propState.id;



Mime
View raw message