jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1521781 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session: RefreshStrategy.java SessionImpl.java operation/SessionOperation.java
Date Wed, 11 Sep 2013 10:11:56 GMT
Author: mduerig
Date: Wed Sep 11 10:11:56 2013
New Revision: 1521781

URL: http://svn.apache.org/r1521781
Log:
OAK-960 Enable session refresh state coordination between multiple session in single thread
Avoid refreshing sessions on logout

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/RefreshStrategy.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/RefreshStrategy.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/RefreshStrategy.java?rev=1521781&r1=1521780&r2=1521781&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/RefreshStrategy.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/RefreshStrategy.java
Wed Sep 11 10:11:56 2013
@@ -71,7 +71,8 @@ public class RefreshStrategy {
     public boolean needsRefresh(SessionOperation<?> sessionOperation) {
         // Don't refresh if this operation is a refresh operation itself or
         // a save operation, which does an implicit refresh
-        if (sessionOperation.isRefresh() || sessionOperation.isSave()) {
+        if (sessionOperation.isRefresh() || sessionOperation.isSave()
+                || sessionOperation.isLogout()) {
             return false;
         }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java?rev=1521781&r1=1521780&r2=1521781&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/SessionImpl.java
Wed Sep 11 10:11:56 2013
@@ -117,6 +117,11 @@ public class SessionImpl implements Jack
         return sd.perform(op);
     }
 
+    @CheckForNull
+    private <T> T safePerform(@Nonnull SessionOperation<T> op) {
+        return sd.safePerform(op);
+    }
+
     @Nonnull
     private String getOakPathOrThrow(String absPath) throws RepositoryException {
         String p = sessionContext.getOakPathOrThrow(absPath);
@@ -438,8 +443,19 @@ public class SessionImpl implements Jack
     @Override
     public void logout() {
         if (sd.isAlive()) {
-            sessionContext.dispose();
-            sd.logout();
+            safePerform(new SessionOperation<Void>() {
+                @Override
+                public Void perform() {
+                    sessionContext.dispose();
+                    sd.logout();
+                    return null;
+                }
+
+                @Override
+                public boolean isLogout() {
+                    return true;
+                }
+            });
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java?rev=1521781&r1=1521780&r2=1521781&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/session/operation/SessionOperation.java
Wed Sep 11 10:11:56 2013
@@ -56,6 +56,10 @@ public abstract class SessionOperation<T
         return false;
     }
 
+    public boolean isLogout() {
+        return false;
+    }
+
     public void checkPreconditions() throws RepositoryException {
     }
 



Mime
View raw message