jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1357265 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state: ItemStateReferenceCache.java SharedItemStateManager.java
Date Wed, 04 Jul 2012 13:47:57 GMT
Author: mreutegg
Date: Wed Jul  4 13:47:56 2012
New Revision: 1357265

URL: http://svn.apache.org/viewvc?rev=1357265&view=rev
Log:
JCR-3345: ACL evaluation may return non-fresh results

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java?rev=1357265&r1=1357264&r2=1357265&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/ItemStateReferenceCache.java
Wed Jul  4 13:47:56 2012
@@ -172,10 +172,11 @@ public class ItemStateReferenceCache imp
         ItemId id = state.getId();
         Map<ItemId, ItemState> segment = getSegment(id);
         synchronized (segment) {
-            if (segment.containsKey(id)) {
+            ItemState s = segment.put(id, state);
+            // overwriting the same instance is OK
+            if (s != null && s != state) {
                 log.warn("overwriting cached entry " + id);
             }
-            segment.put(id, state);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=1357265&r1=1357264&r2=1357265&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Wed Jul  4 13:47:56 2012
@@ -787,6 +787,17 @@ public class SharedItemStateManager
 
             ISMLocking.ReadLock readLock = null;
             try {
+                // make sure new item states are present/referenced in cache
+                // we do this before the lock is downgraded to a read lock
+                // because then other threads will be able to read from
+                // this SISM again and potentially read an added item state
+                // before the ones here are put into the cache (via
+                // shared.persisted()). See JCR-3345
+                for (ItemState state : shared.addedStates()) {
+                    state.setStatus(ItemState.STATUS_EXISTING);
+                    cache.cache(state);
+                }
+
                 // downgrade to read lock
                 readLock = writeLock.downgrade();
                 writeLock = null;



Mime
View raw message