jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1511799 - in /jackrabbit/branches/2.2: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java
Date Thu, 08 Aug 2013 14:19:24 GMT
Author: mreutegg
Date: Thu Aug  8 14:19:24 2013
New Revision: 1511799

URL: http://svn.apache.org/r1511799
Log:
JCR-3617: Inconsistent CachingHierarchyManager under concurrent access
- Merge fix into 2.2 branch

Added:
    jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java
      - copied, changed from r1498840, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java
Modified:
    jackrabbit/branches/2.2/   (props changed)
    jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java

Propchange: jackrabbit/branches/2.2/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1498840,1498850,1499285

Modified: jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java?rev=1511799&r1=1511798&r2=1511799&view=diff
==============================================================================
--- jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
Thu Aug  8 14:19:24 2013
@@ -164,8 +164,12 @@ public class CachingHierarchyManager ext
             String msg = "failed to retrieve state of intermediary node for entry: " 
                     + entry.getId() + ", path: " + path.getString();
             logItemStateException(msg, e);
-            throw new RepositoryException(msg, e);
+            log.debug(msg);
+            // probably stale cache entry -> evict
+            evictAll(entry.getId(), true);
         }
+        // JCR-3617: fall back to super class in case of ItemStateException
+        return super.resolvePath(path, typesAllowed);
     }
 
     /**
@@ -562,7 +566,7 @@ public class CachingHierarchyManager ext
             PathMap.Element<LRUEntry> element = pathCache.put(path);
             if (element.get() != null) {
                 if (!id.equals(((LRUEntry) element.get()).getId())) {
-                    log.warn("overwriting PathMap.Element");
+                    log.debug("overwriting PathMap.Element");
                 }
             }
             LRUEntry entry = (LRUEntry) idCache.get(id);

Copied: jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java
(from r1498840, jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java?p2=jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java&p1=jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java&r1=1498840&r2=1511799&rev=1511799&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java
(original)
+++ jackrabbit/branches/2.2/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/CachingHierarchyManagerConsistencyTest.java
Thu Aug  8 14:19:24 2013
@@ -44,13 +44,9 @@ public class CachingHierarchyManagerCons
     private static final int TEST_DURATION = 10; // seconds
     private static final int NUM_LISTENERS = 10;
     private static final int ALL_EVENTS = Event.NODE_ADDED | Event.NODE_MOVED | Event.NODE_REMOVED
| Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED;
-    private static final String TEST_PATH = "/my/test/path";
+    private static final String TEST_PATH = "my/test/path";
 
     public void testObservation() throws Exception {
-        if (true) {
-            // currently disabled
-            return;
-        }
         final List<Exception> exceptions = new ArrayList<Exception>();
         Thread writer = new Thread(new Runnable() {
             public void run() {
@@ -115,7 +111,10 @@ public class CachingHierarchyManagerCons
 
     private void replaceNodes(Session session, int i) throws RepositoryException {
         String nodeName = "node-" + (i % 100);
-        Node root = JcrUtils.getOrCreateByPath(testRoot + TEST_PATH, ntUnstructured, session);
+        Node root = session.getNode(testRoot);
+        for (String name : TEST_PATH.split("/")) {
+            root = JcrUtils.getOrAddNode(root, name, ntUnstructured);
+        }
         String uuid = UUID.randomUUID().toString();
         if (root.hasNode(nodeName)) {
             Node n = root.getNode(nodeName);



Mime
View raw message