jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r773555 - /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
Date Mon, 11 May 2009 13:34:40 GMT
Author: thomasm
Date: Mon May 11 13:34:40 2009
New Revision: 773555

URL: http://svn.apache.org/viewvc?rev=773555&view=rev
Log:
JCR-2106 SystemSessions created for GarbageCollector are not logged out

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java?rev=773555&r1=773554&r2=773555&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/GarbageCollector.java
Mon May 11 13:34:40 2009
@@ -21,6 +21,7 @@
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.SessionListener;
 import org.apache.jackrabbit.core.observation.SynchronousEventListener;
 import org.apache.jackrabbit.core.persistence.IterablePersistenceManager;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -95,12 +96,23 @@
      *
      * @param list the persistence managers
      */
-    public GarbageCollector(SessionImpl session, IterablePersistenceManager[] list, Session[]
sessionList) {
+    public GarbageCollector(final SessionImpl session, IterablePersistenceManager[] list,
final Session[] sessionList) {
         RepositoryImpl rep = (RepositoryImpl) session.getRepository();
         store = rep.getDataStore();
         this.pmList = list;
         this.persistenceManagerScan = list != null;
         this.sessionList = sessionList;
+        
+        // log out each session as soon as the main session logs out
+        session.addListener(new SessionListener() {
+            public void loggedOut(SessionImpl session) {
+                for (Session s: sessionList) {
+                    s.logout();
+                }
+            }
+            public void loggingOut(SessionImpl session) {
+            }
+        });
     }
 
     /**



Mime
View raw message