You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2012/02/21 15:30:23 UTC

svn commit: r1291800 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ jackrabbit-spi2microkernel/src/main/java/org/ap...

Author: mduerig
Date: Tue Feb 21 14:30:23 2012
New Revision: 1291800

URL: http://svn.apache.org/viewvc?rev=1291800&view=rev
Log:
performance hack

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?rev=1291800&r1=1291799&r2=1291800&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Tue Feb 21 14:30:23 2012
@@ -376,6 +376,10 @@ public class NodeEntry extends Hierarchy
         return resolveItemState();
     }
 
+    // fixme: need better way to determine whether an item exists that catching
+    // fixme: this exceptions. (negative cache, bloom filter)
+    private static final PathNotFoundException PNFE = new PathNotFoundException();
+
     /**
      * Traverse the tree below this entry and return the child entry matching
      * the given path. If that entry has not been loaded yet, try to do so.
@@ -413,20 +417,20 @@ public class NodeEntry extends Hierarchy
                 //    refresh will bring up new entries added in the mean time
                 //    on the persistent layer.
                 if (entry.childNodeEntries.isComplete()) {
-                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
+                    throw PNFE;
                 }
 
                 // -> check for moved child entry in node-attic
                 // -> check if child points to a removed/moved sns
                 NodeEntry sibling = entry.childNodeEntries.get(name);
                 if (entry.containsAtticChild(sibling, name, index)) {
-                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
+                    throw PNFE;
                 }
 
                 // shortcut: entry is NEW and still unresolved remaining path
                 // elements -> hierarchy doesn't exist anyway.
                 if (entry.getStatus() == Status.NEW) {
-                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
+                    throw PNFE;
                 }
 
                 // Unknown entry (not-existing or not yet loaded):
@@ -452,7 +456,7 @@ public class NodeEntry extends Hierarchy
                 if (ne != null) {
                     return ne;
                 } else {
-                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
+                    throw PNFE;
                 }
             }
         }
@@ -497,13 +501,13 @@ public class NodeEntry extends Hierarchy
                 //    refresh will bring up new entries added in the mean time
                 //    on the persistent layer.
                 if (entry.childNodeEntries.isComplete()) {
-                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
+                    throw PNFE;
                 }
                 // -> check for moved child entry in node-attic
                 // -> check if child points to a removed/moved sns
                 NodeEntry sibling = entry.childNodeEntries.get(name);
                 if (entry.containsAtticChild(sibling, name, index)) {
-                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
+                    throw PNFE;
                 }
                 // break out of the loop and start deep loading the property
                 break;
@@ -539,7 +543,7 @@ public class NodeEntry extends Hierarchy
         }
 
         if (pe == null) {
-            throw new PathNotFoundException(factory.saveGetJCRPath(path));
+            throw PNFE;
         }
         return pe;
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=1291800&r1=1291799&r2=1291800&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java Tue Feb 21 14:30:23 2012
@@ -74,7 +74,7 @@ public class WorkspaceItemStateFactory e
 
     // fixme: need better way to determine whether an item exists that catching
     // fixme: this exceptions. (negative cache, bloom filter)
-    private static ItemNotFoundException infe = new ItemNotFoundException();
+    private static final ItemNotFoundException INFE = new ItemNotFoundException();
     /**
      * Creates the node with information retrieved from the {@code RepositoryService}.
      */
@@ -86,7 +86,7 @@ public class WorkspaceItemStateFactory e
             return createNodeState(info, entry);
         }
         catch (PathNotFoundException e) {
-            throw infe;
+            throw INFE;
         }
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1291800&r1=1291799&r2=1291800&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java Tue Feb 21 14:30:23 2012
@@ -326,8 +326,8 @@ public class RepositoryServiceImpl exten
 
     // fixme: need better way to determine whether an item exists that catching
     // fixme: these exceptions. (negative cache, bloom filter)
-    private static ItemNotFoundException infe = new ItemNotFoundException();
-    private static PathNotFoundException pnfe = new PathNotFoundException();
+    private static final ItemNotFoundException INFE = new ItemNotFoundException();
+    private static final PathNotFoundException PNFE = new PathNotFoundException();
 
     @Override
     public Iterator<? extends ItemInfo> getItemInfos(SessionInfo sessionInfo, ItemId itemId) throws RepositoryException {
@@ -337,7 +337,7 @@ public class RepositoryServiceImpl exten
             Path itemPath = getPath(itemId, wspName, rev);
             if (!itemPath.isAbsolute()) {
 //                throw new ItemNotFoundException(itemId.toString());
-                throw infe;
+                throw INFE;
             }
 
             Path nodePath = itemId.denotesNode() ? itemPath : itemPath.getAncestor(1);
@@ -345,7 +345,7 @@ public class RepositoryServiceImpl exten
 
             if (!microKernel.nodeExists(mkPath, rev)) {
 //                throw new PathNotFoundException(itemPath.toString());
-                throw pnfe;
+                throw PNFE;
             }
 
             String json = microKernel.getNodes(mkPath, rev, 1, 0, CHILD_NODE_CHUNK_SIZE);