jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r961326 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: SessionImpl.java WorkspaceImpl.java observation/ObservationManagerImpl.java session/SessionContext.java
Date Wed, 07 Jul 2010 09:55:46 GMT
Author: jukka
Date: Wed Jul  7 09:55:46 2010
New Revision: 961326

URL: http://svn.apache.org/viewvc?rev=961326&view=rev
Log:
JCR-890: concurrent read-only access to a session

Add ObservationManager to the SessionContext. This prevents warning logs during session logout.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java

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=961326&r1=961325&r2=961326&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
Wed Jul  7 09:55:46 2010
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.core.data.G
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.lock.LockManager;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
+import org.apache.jackrabbit.core.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.core.retention.RetentionManagerImpl;
 import org.apache.jackrabbit.core.retention.RetentionRegistry;
 import org.apache.jackrabbit.core.security.AMContext;
@@ -255,6 +256,9 @@ public class SessionImpl extends Abstrac
         context.setItemManager(createItemManager());
         context.setItemValidator(new ItemValidator(context));
         context.setAccessManager(createAccessManager(subject));
+        context.setObservationManager(
+                createObservationManager(wspConfig.getName()));
+
         versionMgr = createVersionManager();
         ntInstanceHandler = new NodeTypeInstanceHandler(userId);
     }
@@ -307,6 +311,19 @@ public class SessionImpl extends Abstrac
         return mgr;
     }
 
+    protected ObservationManagerImpl createObservationManager(String wspName)
+            throws RepositoryException {
+        try {
+            return new ObservationManagerImpl(
+                    repositoryContext.getRepository().getObservationDispatcher(wspName),
+                    this, context.getItemManager(),
+                    repositoryContext.getClusterNode());
+        } catch (NoSuchWorkspaceException e) {
+            // should never get here
+            throw new RepositoryException(
+                    "Internal error: failed to create observation manager", e);
+        }
+    }
     /**
      * Create the version manager. If we are not using XA, we may safely use
      * the repository version manager.

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=961326&r1=961325&r2=961326&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Wed Jul  7 09:55:46 2010
@@ -741,32 +741,12 @@ public class WorkspaceImpl extends Abstr
     }
 
     /**
-     * Returns the observation manager of this session. The observation manager
-     * is lazily created if it does not exist yet.
+     * Returns the observation manager of this session.
      *
      * @return the observation manager of this session
-     * @throws RepositoryException if a repository error occurs
      */
-    public ObservationManager getObservationManager()
-            throws RepositoryException {
-        // check state of this instance
-        sanityCheck();
-
-        if (obsMgr == null) {
-            try {
-                obsMgr = new ObservationManagerImpl(
-                        repositoryContext.getRepository().getObservationDispatcher(wspConfig.getName()),
-                        session,
-                        session.getItemManager(),
-                        repositoryContext.getClusterNode());
-            } catch (NoSuchWorkspaceException nswe) {
-                // should never get here
-                String msg = "internal error: failed to instantiate observation manager";
-                log.debug(msg);
-                throw new RepositoryException(msg, nswe);
-            }
-        }
-        return obsMgr;
+    public ObservationManager getObservationManager() {
+        return sessionContext.getObservationManager();
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java?rev=961326&r1=961325&r2=961326&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ObservationManagerImpl.java
Wed Jul  7 09:55:46 2010
@@ -264,11 +264,10 @@ public class ObservationManagerImpl impl
                     "access EventJournal");
         }
 
-        ObservationManagerImpl obsMgr = (ObservationManagerImpl) session.getWorkspace().getObservationManager();
-        EventFilter filter = obsMgr.createEventFilter(eventTypes, absPath,
-                isDeep, uuid, nodeTypeName, false);
-        return new EventJournalImpl(filter, clusterNode.getJournal(),
-                clusterNode.getId());
+        EventFilter filter = createEventFilter(
+                eventTypes, absPath, isDeep, uuid, nodeTypeName, false);
+        return new EventJournalImpl(
+                filter, clusterNode.getJournal(), clusterNode.getId());
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java?rev=961326&r1=961325&r2=961326&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionContext.java
Wed Jul  7 09:55:46 2010
@@ -23,6 +23,7 @@ import org.apache.jackrabbit.core.Reposi
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.data.DataStore;
 import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.observation.ObservationManagerImpl;
 import org.apache.jackrabbit.core.security.AccessManager;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
 
@@ -57,6 +58,8 @@ public class SessionContext {
      */
     private volatile AccessManager accessManager;
 
+    private volatile ObservationManagerImpl observationManager;
+
     public SessionContext(
             RepositoryContext repositoryContext, SessionImpl session) {
         assert repositoryContext != null;
@@ -142,4 +145,15 @@ public class SessionContext {
         this.accessManager = accessManager;
     }
 
+    public ObservationManagerImpl getObservationManager() {
+        assert observationManager != null;
+        return observationManager;
+    }
+
+    public void setObservationManager(
+            ObservationManagerImpl observationManager) {
+        assert observationManager != null;
+        this.observationManager = observationManager;
+    }
+
 }



Mime
View raw message