jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1002065 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Date Tue, 28 Sep 2010 09:19:49 GMT
Author: jukka
Date: Tue Sep 28 09:19:49 2010
New Revision: 1002065

URL: http://svn.apache.org/viewvc?rev=1002065&view=rev
Log:
JCR-2699: Improve read/write concurrency

Move the persistence manager access outside of the synchronized block in SISM to allow improvements
to PM concurrency to take effect.

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=1002065&r1=1002064&r2=1002065&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
Tue Sep 28 09:19:49 2010
@@ -1699,20 +1699,22 @@ public class SharedItemStateManager
             throws NoSuchItemStateException, ItemStateException {
         ItemState state = cache.retrieve(id);
         if (state == null) {
+            // not found in cache, load from persistent storage
+            state = loadItemState(id);
+            state.setStatus(ItemState.STATUS_EXISTING);
             synchronized (this) {
                 // Use a double check to ensure that the cache entry is
                 // not created twice. We don't synchronize the entire
                 // method to allow the first cache retrieval to proceed
                 // even when another thread is loading a new item state.
-                state = cache.retrieve(id);
-                if (state == null) {
-                    // not found in cache, load from persistent storage
-                    state = loadItemState(id);
-                    state.setStatus(ItemState.STATUS_EXISTING);
+                ItemState cachedState = cache.retrieve(id);
+                if (cachedState == null) {
                     // put it in cache
                     cache.cache(state);
                     // set parent container
                     state.setContainer(this);
+                } else {
+                    state = cachedState;
                 }
             }
         }



Mime
View raw message