jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r919458 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Date Fri, 05 Mar 2010 15:51:07 GMT
Author: jukka
Date: Fri Mar  5 15:51:07 2010
New Revision: 919458

URL: http://svn.apache.org/viewvc?rev=919458&view=rev
Log:
JCR-2546: SISM blocks the item state cache when loading a new item

Synchronize the loading and caching of a new item state on the SISM instance instead of the
cache instance. This allows cache reads to continue while a new item state is being loaded.

Modified:
    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/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=919458&r1=919457&r2=919458&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
Fri Mar  5 15:51:07 2010
@@ -1351,25 +1351,22 @@
 
     /**
      * Returns the item state for the given id without considering virtual
-     * item state providers.
+     * item state providers. This method is synchronized to ensure that
+     * a cache entry is not created twice.
      */
-    private ItemState getNonVirtualItemState(ItemId id)
+    private synchronized ItemState getNonVirtualItemState(ItemId id)
             throws NoSuchItemStateException, ItemStateException {
-
-        // check cache; synchronized to ensure an entry is not created twice.
-        synchronized (cache) {
-            ItemState state = cache.retrieve(id);
-            if (state == null) {
-                // not found in cache, load from persistent storage
-                state = loadItemState(id);
-                state.setStatus(ItemState.STATUS_EXISTING);
-                // put it in cache
-                cache.cache(state);
-                // set parent container
-                state.setContainer(this);
-            }
-            return state;
+        ItemState state = cache.retrieve(id);
+        if (state == null) {
+            // not found in cache, load from persistent storage
+            state = loadItemState(id);
+            state.setStatus(ItemState.STATUS_EXISTING);
+            // put it in cache
+            cache.cache(state);
+            // set parent container
+            state.setContainer(this);
         }
+        return state;
     }
 
     /**



Mime
View raw message