jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r957136 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: SessionImpl.java session/SessionContext.java
Date Wed, 23 Jun 2010 07:55:35 GMT
Author: jukka
Date: Wed Jun 23 07:55:35 2010
New Revision: 957136

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

Move ItemManager into SessionContext.

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/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=957136&r1=957135&r2=957136&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 Jun 23 07:55:35 2010
@@ -167,11 +167,6 @@ public class SessionImpl extends Abstrac
     protected AccessManager accessMgr;
 
     /**
-     * the item mgr associated with this session
-     */
-    protected final ItemManager itemMgr;
-
-    /**
      * the Workspace associated with this session
      */
     protected final WorkspaceImpl wsp;
@@ -275,7 +270,7 @@ public class SessionImpl extends Abstrac
         wsp = createWorkspaceInstance(wspConfig);
         context.setItemStateManager(
                 createSessionItemStateManager(wsp.getItemStateManager()));
-        itemMgr = createItemManager();
+        context.setItemManager(createItemManager());
         accessMgr = createAccessManager(subject);
         versionMgr = createVersionManager();
         ntInstanceHandler = new NodeTypeInstanceHandler(userId);
@@ -449,7 +444,7 @@ public class SessionImpl extends Abstrac
      * @return the <code>ItemManager</code>
      */
     public ItemManager getItemManager() {
-        return itemMgr;
+        return context.getItemManager();
     }
 
     /**
@@ -880,10 +875,10 @@ public class SessionImpl extends Abstrac
                     throws RepositoryException {
                 // JCR-2425: check whether session is allowed to read root node
                 if (hasPermission("/", ACTION_READ)) {
-                    getItemManager().getRootNode().save();
+                    context.getItemManager().getRootNode().save();
                 } else {
                     NodeId id = context.getItemStateManager().getIdOfRootTransientNodeState();
-                    getItemManager().getItem(id).save();
+                    context.getItemManager().getItem(id).save();
                 }
             }
         });
@@ -1200,7 +1195,7 @@ public class SessionImpl extends Abstrac
         // dispose session item state manager
         context.getItemStateManager().dispose();
         // dispose item manager
-        itemMgr.dispose();
+        context.getItemManager().dispose();
         // dispose workspace
         wsp.dispose();
 
@@ -1633,7 +1628,7 @@ public class SessionImpl extends Abstrac
         }
         ps.println(" (" + this + ")");
         ps.println();
-        itemMgr.dump(ps);
+        context.getItemManager().dump(ps);
         ps.println();
         context.getItemStateManager().dump(ps);
     }

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=957136&r1=957135&r2=957136&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 Jun 23 07:55:35 2010
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.session;
 
 import org.apache.jackrabbit.core.HierarchyManager;
+import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.state.SessionItemStateManager;
 
@@ -31,6 +32,12 @@ public class SessionContext {
      */
     private volatile SessionItemStateManager itemStateManager;
 
+    /**
+     * The item manager associated with this session
+     */
+    private volatile ItemManager itemManager;
+
+
     public SessionContext(SessionImpl session) {
         this.session = session;
     }
@@ -62,4 +69,14 @@ public class SessionContext {
         return itemStateManager.getHierarchyMgr();
     }
 
+    public ItemManager getItemManager() {
+        assert itemManager != null;
+        return itemManager;
+    }
+
+    public void setItemManager(ItemManager itemManager) {
+        assert itemManager != null;
+        this.itemManager = itemManager;
+    }
+
 }



Mime
View raw message