jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r956934 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ItemImpl.java SessionImpl.java session/ActiveSessionState.java session/SessionOperation.java
Date Tue, 22 Jun 2010 15:53:02 GMT
Author: jukka
Date: Tue Jun 22 15:53:02 2010
New Revision: 956934

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

Introduce a SessionContext parameter to SessionOperation.perform() so that we'll have an easier
time breaking dependencies in SessionOperation subclasses.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.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/session/ActiveSessionState.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionOperation.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=956934&r1=956933&r2=956934&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
Tue Jun 22 15:53:02 2010
@@ -28,20 +28,17 @@ import java.util.Set;
 import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.Item;
-import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemVisitor;
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.PropertyType;
-import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.ItemDefinition;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.version.VersionException;
@@ -982,7 +979,7 @@ public abstract class ItemImpl implement
         }
 
         @Override
-        public void perform() throws RepositoryException {
+        public void perform(SessionContext context) throws RepositoryException {
             /**
              * build list of transient (i.e. new & modified) states that
              * should be persisted

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=956934&r1=956933&r2=956934&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
Tue Jun 22 15:53:02 2010
@@ -272,7 +272,7 @@ public class SessionImpl extends Abstrac
             RepositoryContext repositoryContext, Subject subject,
             WorkspaceConfig wspConfig)
             throws AccessDeniedException, RepositoryException {
-        this.context.setSessionState(new ActiveSessionState());
+        this.context.setSessionState(new ActiveSessionState(context));
         this.repositoryContext = repositoryContext;
         this.subject = subject;
 
@@ -899,7 +899,8 @@ public class SessionImpl extends Abstrac
     public void save() throws RepositoryException {
         perform(new SessionOperation("save") {
             @Override
-            public void perform() throws RepositoryException {
+            public void perform(SessionContext context)
+                    throws RepositoryException {
                 // JCR-2425: check whether session is allowed to read root node
                 if (hasPermission("/", ACTION_READ)) {
                     getItemManager().getRootNode().save();
@@ -917,7 +918,8 @@ public class SessionImpl extends Abstrac
     public void refresh(final boolean keepChanges) throws RepositoryException {
         perform(new SessionOperation("refresh") {
             @Override
-            public void perform() throws RepositoryException {
+            public void perform(SessionContext context)
+                    throws RepositoryException {
                 // JCR-1753: Ensure that we are up to date with cluster changes
                 ClusterNode cluster = repositoryContext.getClusterNode();
                 if (cluster != null && clusterSyncOnRefresh()) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/ActiveSessionState.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/ActiveSessionState.java?rev=956934&r1=956933&r2=956934&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/ActiveSessionState.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/ActiveSessionState.java
Tue Jun 22 15:53:02 2010
@@ -41,6 +41,15 @@ public class ActiveSessionState implemen
     private final Lock lock = new ReentrantLock();
 
     /**
+     * Component context of this session.
+     */
+    private final SessionContext context;
+
+    public ActiveSessionState(SessionContext context) {
+        this.context = context;
+    }
+
+    /**
      * Returns <code>true</code>; the session is alive.
      *
      * @return <code>true</code>
@@ -63,8 +72,8 @@ public class ActiveSessionState implemen
             lock.lock();
         }
         try {
-            log.debug("Performing {} on {}", operation, this);
-            operation.perform();
+            log.debug("Performing {} on {}", operation, context);
+            operation.perform(context);
         } finally {
             lock.unlock();
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionOperation.java?rev=956934&r1=956933&r2=956934&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionOperation.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/session/SessionOperation.java
Tue Jun 22 15:53:02 2010
@@ -35,9 +35,10 @@ public class SessionOperation {
      * Performs this operation. The default implementation does nothing;
      * subclasses should override this method to implement custom operations.
      *
+     * @param context component context of the session
      * @throws RepositoryException if the operation fails
      */
-    public void perform() throws RepositoryException {
+    public void perform(SessionContext context) throws RepositoryException {
     }
 
     /**



Mime
View raw message