jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r948851 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: RepositoryContext.java RepositoryImpl.java RepositoryManagerImpl.java SessionImpl.java WorkspaceManager.java XASessionImpl.java data/GarbageCollector.java
Date Thu, 27 May 2010 14:44:10 GMT
Author: jukka
Date: Thu May 27 14:44:09 2010
New Revision: 948851

URL: http://svn.apache.org/viewvc?rev=948851&view=rev
Log:
JCR-2640: Internal repository context

Decouple SessionImpl from the details of workspace and data store handling in RepositoryImpl.

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceManager.java
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryContext.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
    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/RepositoryContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryContext.java?rev=948851&r1=948850&r2=948851&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryContext.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryContext.java
Thu May 27 14:44:09 2010
@@ -73,6 +73,11 @@ public class RepositoryContext {
     private ClusterNode clusterNode;
 
     /**
+     * Workspace manager of this repository.
+     */
+    private WorkspaceManager workspaceManager;
+
+    /**
      * Creates a component context for the given repository.
      *
      * @param repository repository instance
@@ -232,4 +237,24 @@ public class RepositoryContext {
         this.clusterNode = clusterNode;
     }
 
+    /**
+     * Returns the workspace manager of this repository.
+     *
+     * @return workspace manager
+     */
+    public WorkspaceManager getWorkspaceManager() {
+        assert workspaceManager != null;
+        return workspaceManager;
+    }
+
+    /**
+     * Sets the workspace manager of this repository.
+     *
+     * @param workspaceManager workspace manager
+     */
+    public void setWorkspaceManager(WorkspaceManager workspaceManager) {
+        assert workspaceManager != null;
+        this.workspaceManager = workspaceManager;
+    }
+
 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=948851&r1=948850&r2=948851&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Thu May 27 14:44:09 2010
@@ -56,6 +56,7 @@ import javax.security.auth.Subject;
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.api.JackrabbitRepository;
+import org.apache.jackrabbit.api.management.RepositoryManager;
 import org.apache.jackrabbit.commons.AbstractRepository;
 import org.apache.jackrabbit.core.cluster.ClusterContext;
 import org.apache.jackrabbit.core.cluster.ClusterException;
@@ -73,6 +74,7 @@ import org.apache.jackrabbit.core.config
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.data.DataStoreException;
+import org.apache.jackrabbit.core.data.GarbageCollector;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.fs.FileSystemException;
 import org.apache.jackrabbit.core.fs.FileSystemResource;
@@ -85,6 +87,7 @@ import org.apache.jackrabbit.core.observ
 import org.apache.jackrabbit.core.observation.EventState;
 import org.apache.jackrabbit.core.observation.EventStateCollection;
 import org.apache.jackrabbit.core.observation.ObservationDispatcher;
+import org.apache.jackrabbit.core.persistence.IterablePersistenceManager;
 import org.apache.jackrabbit.core.persistence.PMContext;
 import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.core.retention.RetentionRegistry;
@@ -303,6 +306,8 @@ public class RepositoryImpl extends Abst
                 context.setDataStore(dataStore);
             }
 
+            context.setWorkspaceManager(new WorkspaceManager(this));
+
             // init workspace configs
             for (WorkspaceConfig config : repConfig.getWorkspaceConfigs()) {
                 WorkspaceInfo info = createWorkspaceInfo(config);
@@ -1336,6 +1341,51 @@ public class RepositoryImpl extends Abst
                 true, cacheFactory, locking);
     }
 
+    /**
+     * Creates a data store garbage collector for this repository.
+     * <p>
+     * Note that you should use the {@link RepositoryManager} interface
+     * to access this functionality. This RepositoryImpl method may be
+     * removed in future Jackrabbit versions. 
+     */
+    public GarbageCollector createDataStoreGarbageCollector()
+            throws RepositoryException {
+        ArrayList<PersistenceManager> pmList = new ArrayList<PersistenceManager>();
+        InternalVersionManagerImpl vm = context.getInternalVersionManager();
+        PersistenceManager pm = vm.getPersistenceManager();
+        pmList.add(pm);
+        String[] wspNames = getWorkspaceNames();
+        Session[] sessions = new Session[wspNames.length];
+        for (int i = 0; i < wspNames.length; i++) {
+            String wspName = wspNames[i];
+            WorkspaceInfo wspInfo = getWorkspaceInfo(wspName);
+            // this will initialize the workspace if required
+            SessionImpl systemSession =
+                SystemSession.create(context, wspInfo.getConfig());
+            // mark this session as 'active' so the workspace does not get disposed
+            // by the workspace-janitor until the garbage collector is done
+            onSessionCreated(systemSession);
+            // the workspace could be disposed again, so re-initialize if required
+            // afterwards it will not be disposed because a session is registered
+            wspInfo.initialize();
+            sessions[i] = systemSession;
+            pm = wspInfo.getPersistenceManager();
+            pmList.add(pm);
+        }
+        IterablePersistenceManager[] ipmList =
+            new IterablePersistenceManager[pmList.size()];
+        for (int i = 0; i < pmList.size(); i++) {
+            pm = pmList.get(i);
+            if (!(pm instanceof IterablePersistenceManager)) {
+                ipmList = null;
+                break;
+            }
+            ipmList[i] = (IterablePersistenceManager) pm;
+        }
+        return new GarbageCollector(context.getDataStore(), ipmList, sessions);
+    }
+
+
     //-----------------------------------------------------------< Repository >
     /**
      * {@inheritDoc}

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java?rev=948851&r1=948850&r2=948851&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryManagerImpl.java
Thu May 27 14:44:09 2010
@@ -16,18 +16,10 @@
  */
 package org.apache.jackrabbit.core;
 
-import java.util.ArrayList;
-
 import javax.jcr.RepositoryException;
-import javax.jcr.Session;
 
 import org.apache.jackrabbit.api.management.DataStoreGarbageCollector;
 import org.apache.jackrabbit.api.management.RepositoryManager;
-import org.apache.jackrabbit.core.RepositoryImpl.WorkspaceInfo;
-import org.apache.jackrabbit.core.data.GarbageCollector;
-import org.apache.jackrabbit.core.persistence.IterablePersistenceManager;
-import org.apache.jackrabbit.core.persistence.PersistenceManager;
-import org.apache.jackrabbit.core.version.InternalVersionManagerImpl;
 
 /**
  * The repository manager implementation.
@@ -42,45 +34,11 @@ public class RepositoryManagerImpl imple
 
     public DataStoreGarbageCollector createDataStoreGarbageCollector() throws RepositoryException
{
         RepositoryImpl rep = tr.getRepository();
-        if (rep == null) {
+        if (rep != null) {
+            return rep.createDataStoreGarbageCollector();
+        } else {
             throw new RepositoryException("Repository is stopped");
         }
-        ArrayList<PersistenceManager> pmList = new ArrayList<PersistenceManager>();
-        InternalVersionManagerImpl vm =
-            rep.getRepositoryContext().getInternalVersionManager();
-        PersistenceManager pm = vm.getPersistenceManager();
-        pmList.add(pm);
-        String[] wspNames = rep.getWorkspaceNames();
-        Session[] sessions = new Session[wspNames.length];
-        for (int i = 0; i < wspNames.length; i++) {
-            String wspName = wspNames[i];
-            WorkspaceInfo wspInfo = rep.getWorkspaceInfo(wspName);
-            // this will initialize the workspace if required
-            SessionImpl session = SystemSession.create(
-                    rep.getRepositoryContext(), wspInfo.getConfig());
-            // mark this session as 'active' so the workspace does not get disposed
-            // by the workspace-janitor until the garbage collector is done
-            rep.onSessionCreated(session);
-            // the workspace could be disposed again, so re-initialize if required
-            // afterwards it will not be disposed because a session is registered
-            wspInfo.initialize();
-            sessions[i] = session;
-            pm = wspInfo.getPersistenceManager();
-            pmList.add(pm);
-        }
-        IterablePersistenceManager[] ipmList = new IterablePersistenceManager[pmList.size()];
-        for (int i = 0; i < pmList.size(); i++) {
-            pm = pmList.get(i);
-            if (!(pm instanceof IterablePersistenceManager)) {
-                ipmList = null;
-                break;
-            }
-            ipmList[i] = (IterablePersistenceManager) pm;
-        }
-        GarbageCollector gc = new GarbageCollector(
-                rep.getRepositoryContext().getDataStore(),
-                null, ipmList, sessions);
-        return gc;
     }
 
     public void stop() {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=948851&r1=948850&r2=948851&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Thu May 27 14:44:09 2010
@@ -22,7 +22,6 @@ import org.apache.jackrabbit.api.Jackrab
 import org.apache.jackrabbit.api.security.principal.PrincipalManager;
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.commons.AbstractSession;
-import org.apache.jackrabbit.core.RepositoryImpl.WorkspaceInfo;
 import org.apache.jackrabbit.core.cluster.ClusterException;
 import org.apache.jackrabbit.core.cluster.ClusterNode;
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
@@ -31,8 +30,6 @@ import org.apache.jackrabbit.core.id.Nod
 import org.apache.jackrabbit.core.lock.LockManager;
 import org.apache.jackrabbit.core.nodetype.NodeTypeImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
-import org.apache.jackrabbit.core.persistence.IterablePersistenceManager;
-import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.core.retention.RetentionManagerImpl;
 import org.apache.jackrabbit.core.retention.RetentionRegistry;
 import org.apache.jackrabbit.core.security.AMContext;
@@ -47,7 +44,6 @@ import org.apache.jackrabbit.core.state.
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.core.value.ValueFactoryImpl;
 import org.apache.jackrabbit.core.version.InternalVersionManager;
-import org.apache.jackrabbit.core.version.InternalVersionManagerImpl;
 import org.apache.jackrabbit.core.xml.ImportHandler;
 import org.apache.jackrabbit.core.xml.SessionImporter;
 import org.apache.jackrabbit.spi.Name;
@@ -293,12 +289,13 @@ public class SessionImpl extends Abstrac
                 repositoryContext.getDataStore());
         String wspName = wspConfig.getName();
         wsp = createWorkspaceInstance(
-                wspConfig, rep.getWorkspaceStateManager(wspName));
+                wspConfig,
+                repositoryContext.getWorkspaceManager().getWorkspaceStateManager(wspName));
         itemStateMgr = createSessionItemStateManager(wsp.getItemStateManager());
         hierMgr = itemStateMgr.getHierarchyMgr();
         itemMgr = createItemManager(itemStateMgr, hierMgr);
         accessMgr = createAccessManager(subject, itemStateMgr.getHierarchyMgr());
-        versionMgr = createVersionManager(rep);
+        versionMgr = createVersionManager();
         ntInstanceHandler = new NodeTypeInstanceHandler(userId);
     }
 
@@ -354,7 +351,7 @@ public class SessionImpl extends Abstrac
      * the repository version manager.
      * @return version manager
      */
-    protected InternalVersionManager createVersionManager(RepositoryImpl rep)
+    protected InternalVersionManager createVersionManager()
             throws RepositoryException {
         return repositoryContext.getInternalVersionManager();
     }
@@ -436,9 +433,9 @@ public class SessionImpl extends Abstrac
       */
     public Session createSession(String workspaceName)
             throws AccessDeniedException, NoSuchWorkspaceException, RepositoryException {
-
         if (workspaceName == null) {
-            workspaceName = rep.getConfig().getDefaultWorkspaceName();
+            workspaceName =
+                repositoryContext.getWorkspaceManager().getDefaultWorkspaceName();
         }
         Subject old = getSubject();
         Subject newSubject = new Subject(old.isReadOnly(), old.getPrincipals(), old.getPublicCredentials(),
old.getPrivateCredentials());
@@ -566,7 +563,7 @@ public class SessionImpl extends Abstrac
     protected String[] getWorkspaceNames() throws RepositoryException {
         // filter workspaces according to access rights
         List<String> names = new ArrayList<String>();
-        for (String name : rep.getWorkspaceNames()) {
+        for (String name : repositoryContext.getWorkspaceManager().getWorkspaceNames()) {
             try {
                 if (getAccessManager().canAccess(name)) {
                     names.add(name);
@@ -590,7 +587,7 @@ public class SessionImpl extends Abstrac
     protected void createWorkspace(String workspaceName)
             throws AccessDeniedException, RepositoryException {
         // @todo verify that this session has the right privileges for this operation
-        rep.createWorkspace(workspaceName);
+        repositoryContext.getWorkspaceManager().createWorkspace(workspaceName);
     }
 
     /**
@@ -604,11 +601,12 @@ public class SessionImpl extends Abstrac
      * @throws RepositoryException   if a workspace with the given name already
      *                               exists or if another error occurs
      */
-    protected void createWorkspace(String workspaceName,
-                                   InputSource configTemplate)
+    protected void createWorkspace(
+            String workspaceName, InputSource configTemplate)
             throws AccessDeniedException, RepositoryException {
         // @todo verify that this session has the right privileges for this operation
-        rep.createWorkspace(workspaceName, configTemplate);
+        repositoryContext.getWorkspaceManager().createWorkspace(
+                workspaceName, configTemplate);
     }
 
     /**
@@ -665,39 +663,15 @@ public class SessionImpl extends Abstrac
      * @throws RepositoryException
      */
     public GarbageCollector createDataStoreGarbageCollector() throws RepositoryException
{
-        ArrayList<PersistenceManager> pmList = new ArrayList<PersistenceManager>();
-        InternalVersionManagerImpl vm = repositoryContext.getInternalVersionManager();
-        PersistenceManager pm = vm.getPersistenceManager();
-        pmList.add(pm);
-        String[] wspNames = rep.getWorkspaceNames();
-        Session[] sessions = new Session[wspNames.length];
-        for (int i = 0; i < wspNames.length; i++) {
-            String wspName = wspNames[i];
-            WorkspaceInfo wspInfo = rep.getWorkspaceInfo(wspName);
-            // this will initialize the workspace if required
-            SessionImpl session =
-                SystemSession.create(repositoryContext, wspInfo.getConfig());
-            // mark this session as 'active' so the workspace does not get disposed
-            // by the workspace-janitor until the garbage collector is done
-            rep.onSessionCreated(session);
-            // the workspace could be disposed again, so re-initialize if required
-            // afterwards it will not be disposed because a session is registered
-            wspInfo.initialize();
-            sessions[i] = session;
-            pm = wspInfo.getPersistenceManager();
-            pmList.add(pm);
-        }
-        IterablePersistenceManager[] ipmList = new IterablePersistenceManager[pmList.size()];
-        for (int i = 0; i < pmList.size(); i++) {
-            pm = pmList.get(i);
-            if (!(pm instanceof IterablePersistenceManager)) {
-                ipmList = null;
-                break;
+        final GarbageCollector gc = rep.createDataStoreGarbageCollector();
+        // Auto-close if the main session logs out
+        addListener(new SessionListener() {
+            public void loggedOut(SessionImpl session) {
             }
-            ipmList[i] = (IterablePersistenceManager) pm;
-        }
-        GarbageCollector gc = new GarbageCollector(
-                repositoryContext.getDataStore(), this, ipmList, sessions);
+            public void loggingOut(SessionImpl session) {
+                gc.close();
+            }
+        });
         return gc;
     }
 
@@ -834,7 +808,8 @@ public class SessionImpl extends Abstrac
         creds.setAttribute(SecurityConstants.IMPERSONATOR_ATTRIBUTE, subject);
 
         try {
-            return rep.login(otherCredentials, getWorkspace().getName());
+            return getRepository().login(
+                    otherCredentials, getWorkspace().getName());
         } catch (NoSuchWorkspaceException nswe) {
             // should never get here...
             String msg = "impersonate failed";

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceManager.java?rev=948851&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceManager.java
(added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceManager.java
Thu May 27 14:44:09 2010
@@ -0,0 +1,88 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.core;
+
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.core.state.SharedItemStateManager;
+import org.xml.sax.InputSource;
+
+/**
+ * Utility class that decouples {@link SessionImpl} from the internal
+ * workspace handling details of {@link RepositoryImpl}.
+ */
+public class WorkspaceManager {
+
+    private final RepositoryImpl repository;
+
+    WorkspaceManager(RepositoryImpl repository) {
+        this.repository = repository;
+    }
+
+    /**
+     * Returns the name of the default workspace.
+     *
+     * @return default workspace name
+     */
+    public String getDefaultWorkspaceName() {
+        return repository.getConfig().getDefaultWorkspaceName();
+    }
+
+    /**
+     * Returns the names of all the available workspaces.
+     *
+     * @return workspace names
+     */
+    public String[] getWorkspaceNames() {
+        return repository.getWorkspaceNames();
+    }
+
+    /**
+     * Creates a workspace with the given name.
+     *
+     * @param workspaceName name of the new workspace
+     * @throws RepositoryException if a workspace with the given name
+     *                             already exists or if another error occurs
+     */
+    public void createWorkspace(String workspaceName)
+            throws RepositoryException {
+        repository.createWorkspace(workspaceName);
+    }
+
+    /**
+     * Creates a workspace with the given name and a workspace configuration
+     * template.
+     *
+     * @param workspaceName  name of the new workspace
+     * @param configTemplate the configuration template of the new workspace
+     * @throws RepositoryException if a workspace with the given name already
+     *                             exists or if another error occurs
+     */
+    public void createWorkspace(
+            String workspaceName, InputSource configTemplate)
+            throws RepositoryException {
+        repository.createWorkspace(workspaceName, configTemplate);
+    }
+
+    // FIXME: This is a too low-level method. Refactor...
+    public SharedItemStateManager getWorkspaceStateManager(String workspaceName)
+            throws NoSuchWorkspaceException, RepositoryException {
+        return repository.getWorkspaceStateManager(workspaceName);
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java?rev=948851&r1=948850&r2=948851&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/XASessionImpl.java
Thu May 27 14:44:09 2010
@@ -166,7 +166,8 @@ public class XASessionImpl extends Sessi
     /**
      * {@inheritDoc}
      */
-    protected InternalVersionManager createVersionManager(RepositoryImpl rep)
+    @Override
+    protected InternalVersionManager createVersionManager()
             throws RepositoryException {
         return new InternalXAVersionManager(
                 repositoryContext.getInternalVersionManager(),

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=948851&r1=948850&r2=948851&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
Thu May 27 14:44:09 2010
@@ -20,8 +20,6 @@ import org.apache.jackrabbit.api.managem
 import org.apache.jackrabbit.api.management.MarkEventListener;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.id.PropertyId;
-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,7 +93,6 @@ public class GarbageCollector implements
     private final IterablePersistenceManager[] pmList;
 
     private final Session[] sessionList;
-    private SessionListener sessionListener;
 
     private final AtomicBoolean closed = new AtomicBoolean();
 
@@ -107,29 +104,16 @@ public class GarbageCollector implements
      * by SessionImpl.createDataStoreGarbageCollector().
      *
      * @param dataStore the data store to be garbage-collected
-     * @param session the session that created this object (optional)
      * @param list the persistence managers
      * @param sessionList the sessions to access the workspaces
      */
     public GarbageCollector(
-            DataStore dataStore, SessionImpl session,
-            IterablePersistenceManager[] list, Session[] sessionList) {
+            DataStore dataStore, IterablePersistenceManager[] list,
+            Session[] sessionList) {
         this.store = dataStore;
         this.pmList = list;
         this.persistenceManagerScan = list != null;
         this.sessionList = sessionList;
-
-        if (session != null) {
-            // Auto-close if the main session logs out
-            this.sessionListener = new SessionListener() {
-                public void loggedOut(SessionImpl session) {
-                }
-                public void loggingOut(SessionImpl session) {
-                    close();
-                }
-            };
-            session.addListener(sessionListener);
-        }
     }
 
     public void setSleepBetweenNodes(long millis) {



Mime
View raw message