jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1166266 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/ jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/
Date Wed, 07 Sep 2011 17:08:17 GMT
Author: mduerig
Date: Wed Sep  7 17:08:16 2011
New Revision: 1166266

URL: http://svn.apache.org/viewvc?rev=1166266&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
minor refactor of observation

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionState.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java?rev=1166266&r1=1166265&r2=1166266&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
Wed Sep  7 17:08:16 2011
@@ -39,9 +39,6 @@ import java.util.ArrayList;
 /**
  * {@code AbstractNodeType}...
  */
-/**
- * {@code AbstractNodeType}...
- */
 public abstract class AbstractNodeType implements NodeType {
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionState.java?rev=1166266&r1=1166265&r2=1166266&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionState.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SessionState.java
Wed Sep  7 17:08:16 2011
@@ -51,6 +51,16 @@ public class SessionState {
     }
 
     /**
+     * The initial revision from when the session was created
+     * @return
+     */
+    public String getInitialRevision() {
+        synchronized (commitLog) {
+            return commitLog.get(commitLog.size() - 1);
+        }
+    }
+
+    /**
      * Snapshot of this session state's commit log at the time of the call
      * @return
      */
@@ -61,4 +71,14 @@ public class SessionState {
         }
         return commitLog;
     }
+
+    /**
+     * Determines whether the given {@code revisionId} was committed by this session.
+     * That is, whether the commit log of this instance contains the given revisionId.
+     * @param revisionId
+     * @return
+     */
+    public boolean hasRevision(String revisionId) {
+        return getCommitLog().contains(revisionId);
+    }
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java?rev=1166266&r1=1166265&r2=1166266&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/SubscriptionImpl.java
Wed Sep  7 17:08:16 2011
@@ -237,8 +237,7 @@ public class SubscriptionImpl implements
 
         public EventSource(EventFilter[] eventFilters, SessionState sessionState) {
             this.eventFilters = eventFilters;
-            List<String> commitLog = sessionState.getCommitLog();
-            startRevision = commitLog.get(commitLog.size() - 1);
+            startRevision = sessionState.getInitialRevision();
         }
 
         public EventSource(EventFilter[] eventFilters, String startRevision) {
@@ -309,9 +308,7 @@ public class SubscriptionImpl implements
                     .setUserData(commitMessage.getUserData());
 
             Collection<Event> events = getEvents(changes, eventTemplate);
-
-            // todo performance: this does a linear search on the list
-            boolean isLocal = sessionState.getCommitLog().contains(revisionId);
+            boolean isLocal = sessionState.hasRevision(revisionId);
 
             // events.filter(event => eventFilters.any(_.accept(event, isLocal))
             for (Iterator<Event> it = events.iterator(); it.hasNext(); ) {



Mime
View raw message