jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1528033 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core: ImmutableTree.java TreeTypeProvider.java
Date Tue, 01 Oct 2013 10:19:47 GMT
Author: angela
Date: Tue Oct  1 10:19:47 2013
New Revision: 1528033

URL: http://svn.apache.org/r1528033
Log:
OAK-1058 : Review TreeTypeProvider

- avoid recalculating the tree type

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java?rev=1528033&r1=1528032&r2=1528033&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ImmutableTree.java
Tue Oct  1 10:19:47 2013
@@ -98,6 +98,7 @@ public final class ImmutableTree extends
     private final TreeTypeProvider typeProvider;
 
     private String path;
+    private int type = TreeTypeProvider.TYPE_NONE;
 
     public ImmutableTree(@Nonnull NodeState rootState) {
         this(ParentProvider.ROOT_PROVIDER, "", rootState, TreeTypeProvider.EMPTY);
@@ -249,7 +250,10 @@ public final class ImmutableTree extends
     //------------------------------------------------------------< internal >---
 
     int getType() {
-        return typeProvider.getType(this);
+        if (type == TreeTypeProvider.TYPE_NONE) {
+            type = typeProvider.getType(this);
+        }
+        return type;
     }
 
     // TODO

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProvider.java?rev=1528033&r1=1528032&r2=1528033&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeTypeProvider.java
Tue Oct  1 10:19:47 2013
@@ -23,6 +23,8 @@ import javax.annotation.Nullable;
  */
 public interface TreeTypeProvider {
 
+    int TYPE_NONE = 0;
+
     // regular trees
     int TYPE_DEFAULT = 1;
     // version store(s) content



Mime
View raw message