jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1241525 - in /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model: ChildNodeEntriesTree.java MutableNode.java
Date Tue, 07 Feb 2012 17:18:38 GMT
Author: stefan
Date: Tue Feb  7 17:18:38 2012
New Revision: 1241525

URL: http://svn.apache.org/viewvc?rev=1241525&view=rev
Log:
child node entries: switch to  htree structure when exceeding a certain threshold

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/MutableNode.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java?rev=1241525&r1=1241524&r2=1241525&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
Tue Feb  7 17:18:38 2012
@@ -93,7 +93,8 @@ public class ChildNodeEntriesTree implem
             return null;
         }
         if (entry instanceof ChildNodeEntry) {
-            return (ChildNodeEntry) entry;
+            ChildNodeEntry cne = (ChildNodeEntry) entry;
+            return cne.getName().equals(name) ? cne : null;
         } else if (entry instanceof BucketInfo) {
             BucketInfo bi = (BucketInfo) entry;
             ChildNodeEntries entries = retrieveBucket(bi.getId());

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/MutableNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/MutableNode.java?rev=1241525&r1=1241524&r2=1241525&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/MutableNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/MutableNode.java
Tue Feb  7 17:18:38 2012
@@ -20,6 +20,8 @@ import org.apache.jackrabbit.mk.store.Pe
 import org.apache.jackrabbit.mk.store.RevisionProvider;
 import org.apache.jackrabbit.mk.store.RevisionStore;
 
+import java.util.Iterator;
+
 /**
  *
  */
@@ -34,7 +36,17 @@ public class MutableNode extends Abstrac
     }
 
     public ChildNodeEntry add(ChildNodeEntry newEntry) {
-        return childEntries.add(newEntry);
+        ChildNodeEntry existing = childEntries.add(newEntry);
+        if (childEntries.getCount() > ChildNodeEntries.CAPACITY_THRESHOLD
+                && childEntries.inlined()) {
+            ChildNodeEntries entries = new ChildNodeEntriesTree(provider);
+            Iterator<ChildNodeEntry> iter = childEntries.getEntries(0, -1);
+            while (iter.hasNext()) {
+                entries.add(iter.next());
+            }
+            childEntries = entries;
+        }
+        return existing;
     }
     
     public ChildNodeEntry remove(String name) {



Mime
View raw message