jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1365573 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: RepositoryImpl.java SessionDelegate.java
Date Wed, 25 Jul 2012 13:36:22 GMT
Author: mduerig
Date: Wed Jul 25 13:36:21 2012
New Revision: 1365573

URL: http://svn.apache.org/viewvc?rev=1365573&view=rev
Log:
OAK-88: Auto-refresh mode
add auto refresh support to SessionDelegate. Not currently enabled. 

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

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1365573&r1=1365572&r2=1365573&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Wed Jul 25 13:36:21 2012
@@ -131,7 +131,7 @@ public class RepositoryImpl implements R
         // TODO: needs complete refactoring
         try {
             ContentSession contentSession = contentRepository.login(credentials, workspaceName);
-            return new SessionDelegate(this, observationTimer, contentSession).getSession();
+            return new SessionDelegate(this, observationTimer, contentSession, true).getSession();
         } catch (LoginException e) {
             throw new javax.jcr.LoginException(e.getMessage());
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1365573&r1=1365572&r2=1365573&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed Jul 25 13:36:21 2012
@@ -73,13 +73,14 @@ public class SessionDelegate {
     private final Session session;
     private final Root root;
     private final ConflictHandler conflictHandler;
+    private final boolean autoRefresh;
 
     private ObservationManagerImpl observationManager;
     private boolean isAlive = true;
     private int sessionOpCount;
 
-    SessionDelegate(Repository repository, LazyValue<Timer> observationTimer, ContentSession
contentSession)
-            throws RepositoryException {
+    SessionDelegate(Repository repository, LazyValue<Timer> observationTimer, ContentSession
contentSession,
+            boolean autoRefresh) throws RepositoryException {
         assert repository != null;
         assert contentSession != null;
 
@@ -91,6 +92,7 @@ public class SessionDelegate {
         this.session = new SessionImpl(this);
         this.root = contentSession.getCurrentRoot();
         this.conflictHandler = new AnnotatingConflictHandler(contentSession.getCoreValueFactory());
+        this.autoRefresh = autoRefresh;
     }
 
     /**
@@ -118,9 +120,11 @@ public class SessionDelegate {
     }
 
     private boolean needsRefresh() {
-        // Refresh is needed only for non re-entrant session operations and only if
+        // Refresh is always needed if this is an auto refresh session. Otherwise
+        // refresh in only needed for non re-entrant session operations and only if
         // observation events have actually been delivered
-        return sessionOpCount <= 1 && observationManager != null && observationManager.hasEvents();
+        return autoRefresh ||
+                (sessionOpCount <= 1 && observationManager != null &&
observationManager.hasEvents());
     }
 
     public boolean isAlive() {



Mime
View raw message