jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1517849 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate: RefreshManager.java SessionDelegate.java
Date Tue, 27 Aug 2013 15:34:19 GMT
Author: mduerig
Date: Tue Aug 27 15:34:19 2013
New Revision: 1517849

URL: http://svn.apache.org/r1517849
Log:
OAK-960 Enable session refresh state coordination between multiple session in single thread
Encapsulation: keep the actual refreshing in SessionDelegate

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/RefreshManager.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/RefreshManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/RefreshManager.java?rev=1517849&r1=1517848&r2=1517849&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/RefreshManager.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/RefreshManager.java
Tue Aug 27 15:34:19 2013
@@ -67,13 +67,13 @@ public class RefreshManager {
 
     /**
      * Called before the passed {@code sessionOperation} is performed. This method
-     * refreshes the session according to the rules given in the class comment.
+     * determines whether a session needs to be refreshed according to the rules
+     * given in the class comment.
      *
-     * @param delegate  session on which the {@code sessionOperation} is executed
      * @param sessionOperation  the operation to be executed
      * @return  {@code true} if a refreshed, {@code false} otherwise.
      */
-    boolean refreshIfNecessary(SessionDelegate delegate, SessionOperation<?> sessionOperation)
{
+    boolean needsRefresh(SessionOperation<?> sessionOperation) {
         long now = System.currentTimeMillis();
         long timeElapsed = now - lastAccessed;
         lastAccessed = now;
@@ -93,7 +93,6 @@ public class RefreshManager {
                 // Refresh if forced or if the session has been idle too long
                 refreshAtNextAccess = false;
                 sessionSaveCount = getOr0(threadSaveCount);
-                delegate.refresh(true);
                 return true;
             }
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java?rev=1517849&r1=1517848&r2=1517849&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/SessionDelegate.java
Tue Aug 27 15:34:19 2013
@@ -105,7 +105,8 @@ public class SessionDelegate {
         // Synchronize to avoid conflicting refreshes from concurrent JCR API calls
         if (sessionOpCount == 0) {
             // Refresh and precondition checks only for non re-entrant session operations
-            if (refreshManager.refreshIfNecessary(this, sessionOperation)) {
+            if (refreshManager.needsRefresh(sessionOperation)) {
+                refresh(true);
                 updateCount++;
             }
             sessionOperation.checkPreconditions();



Mime
View raw message