jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r164771 - /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
Date Tue, 26 Apr 2005 10:36:27 GMT
Author: stefan
Date: Tue Apr 26 03:36:24 2005
New Revision: 164771

URL: http://svn.apache.org/viewcvs?rev=164771&view=rev
Log:
- minor performance improvements

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java?rev=164771&r1=164770&r2=164771&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
Tue Apr 26 03:36:24 2005
@@ -148,8 +148,19 @@
      */
     public boolean isAncestor(NodeId nodeId, ItemId itemId)
             throws ItemNotFoundException, RepositoryException {
-        // do not used cached paths. calculating paths is more expesive
-        return delegatee.isAncestor(nodeId, itemId);
+        if (pathCache.containsKey(nodeId) && pathCache.containsKey(itemId)) {
+            // use cached Path objects rather than calling delegatee
+            try {
+                return getPath(nodeId).isAncestorOf(getPath(itemId));
+            } catch (MalformedPathException mpe) {
+                // should never get here...
+                String msg = "failed to determine degree of relationship of "
+                        + nodeId + " and " + itemId;
+                throw new ItemNotFoundException(msg, mpe);
+            }
+        } else {
+            return delegatee.isAncestor(nodeId, itemId);
+        }
     }
 
     /**



Mime
View raw message