jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1360185 - in /jackrabbit/oak/trunk/oak-jcr: ./ src/main/java/org/apache/jackrabbit/oak/jcr/ src/main/java/org/apache/jackrabbit/oak/jcr/observation/
Date Wed, 11 Jul 2012 14:19:02 GMT
Author: mduerig
Date: Wed Jul 11 14:19:02 2012
New Revision: 1360185

URL: http://svn.apache.org/viewvc?rev=1360185&view=rev
Log:
Revert: OAK-156: Observation events need Session.refresh

Modified:
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ObservationManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1360185&r1=1360184&r2=1360185&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Wed Jul 11 14:19:02 2012
@@ -95,6 +95,7 @@ org.apache.jackrabbit.test.api.observati
 org.apache.jackrabbit.test.api.observation.NodeReorderTest#testNodeReorderSameNameWithRemove
 <!-- reorder not supported -->
 org.apache.jackrabbit.test.api.observation.AddEventListenerTest#testNodeType
 org.apache.jackrabbit.test.api.observation.AddEventListenerTest#testNoLocalTrue
+org.apache.jackrabbit.test.api.observation.WorkspaceOperationTest#testCopy              
     <!-- OAK-156 -->
 org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeAdded
 org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeMoved
 org.apache.jackrabbit.test.api.observation.GetIdentifierTest#testNodeRemoved

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java?rev=1360185&r1=1360184&r2=1360185&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/PropertyDelegate.java
Wed Jul 11 14:19:02 2012
@@ -252,7 +252,7 @@ public class PropertyDelegate extends It
     //------------------------------------------------------------< private >---
 
     @Nonnull
-    private synchronized PropertyState getPropertyState() throws InvalidItemStateException
{
+    private PropertyState getPropertyState() throws InvalidItemStateException {
         resolve();
         if (parent == null) {
             throw new InvalidItemStateException("Property is stale");
@@ -262,7 +262,7 @@ public class PropertyDelegate extends It
     }
 
     @Nonnull
-    private synchronized Tree getParentTree() throws InvalidItemStateException {
+    private Tree getParentTree() throws InvalidItemStateException {
         resolve();
         if (parent == null) {
             throw new InvalidItemStateException("Property is stale");

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1360185&r1=1360184&r2=1360185&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed Jul 11 14:19:02 2012
@@ -185,16 +185,12 @@ public class SessionDelegate {
     }
 
     public boolean hasPendingChanges() {
-        synchronized (root) {
-            return root.hasPendingChanges();
-        }
+        return root.hasPendingChanges();
     }
 
     public void save() throws RepositoryException {
         try {
-            synchronized (root) {
-                root.commit(conflictHandler);
-            }
+            root.commit(conflictHandler);
         }
         catch (CommitFailedException e) {
             e.throwRepositoryException();
@@ -202,13 +198,11 @@ public class SessionDelegate {
     }
 
     public void refresh(boolean keepChanges) {
-        synchronized (root) {
-            if (keepChanges) {
-                root.rebase(conflictHandler);
-            }
-            else {
-                root.refresh();
-            }
+        if (keepChanges) {
+            root.rebase(conflictHandler);
+        }
+        else {
+            root.refresh();
         }
     }
 
@@ -279,9 +273,7 @@ public class SessionDelegate {
 
     @Nonnull
     public ChangeExtractor getChangeExtractor() {
-        synchronized (root) {
-            return root.getChangeExtractor();
-        }
+        return root.getChangeExtractor();
     }
 
     //----------------------------------------------------------< Workspace >---
@@ -332,40 +324,38 @@ public class SessionDelegate {
     public void move(String srcAbsPath, String destAbsPath, boolean transientOp)
             throws RepositoryException {
 
-        synchronized (root) {
-            String srcPath = PathUtils.relativize("/", srcAbsPath);
-            String destPath = PathUtils.relativize("/", destAbsPath);
-            Root moveRoot = transientOp ? root : contentSession.getCurrentRoot();
-
-            // check destination
-            Tree dest = moveRoot.getTree(destPath);
-            if (dest != null) {
-                throw new ItemExistsException(destAbsPath);
-            }
+        String srcPath = PathUtils.relativize("/", srcAbsPath);
+        String destPath = PathUtils.relativize("/", destAbsPath);
+        Root moveRoot = transientOp ? root : contentSession.getCurrentRoot();
 
-            // check parent of destination
-            String destParentPath = PathUtils.getParentPath(destPath);
-            Tree destParent = moveRoot.getTree(destParentPath);
-            if (destParent == null) {
-                throw new PathNotFoundException(PathUtils.getParentPath(destAbsPath));
-            }
+        // check destination
+        Tree dest = moveRoot.getTree(destPath);
+        if (dest != null) {
+            throw new ItemExistsException(destAbsPath);
+        }
 
-            // check source exists
-            Tree src = moveRoot.getTree(srcPath);
-            if (src == null) {
-                throw new PathNotFoundException(srcAbsPath);
-            }
+        // check parent of destination
+        String destParentPath = PathUtils.getParentPath(destPath);
+        Tree destParent = moveRoot.getTree(destParentPath);
+        if (destParent == null) {
+            throw new PathNotFoundException(PathUtils.getParentPath(destAbsPath));
+        }
 
-            try {
-                moveRoot.move(srcPath, destPath);
-                if (!transientOp) {
-                    moveRoot.commit(DefaultConflictHandler.OURS);
-                }
-            }
-            catch (CommitFailedException e) {
-                e.throwRepositoryException();
+        // check source exists
+        Tree src = moveRoot.getTree(srcPath);
+        if (src == null) {
+            throw new PathNotFoundException(srcAbsPath);
+        }
+
+        try {
+            moveRoot.move(srcPath, destPath);
+            if (!transientOp) {
+                moveRoot.commit(DefaultConflictHandler.OURS);
             }
         }
+        catch (CommitFailedException e) {
+            e.throwRepositoryException();
+        }
     }
 
     @Nonnull
@@ -410,9 +400,7 @@ public class SessionDelegate {
 
     @CheckForNull
     Tree getTree(String path) {
-        synchronized (root) {
-            return root.getTree(path);
-        }
+        return root.getTree(path);
     }
 
     @CheckForNull

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java?rev=1360185&r1=1360184&r2=1360185&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ChangeProcessor.java
Wed Jul 11 14:19:02 2012
@@ -29,7 +29,6 @@ import org.apache.jackrabbit.commons.ite
 import org.apache.jackrabbit.oak.api.ChangeExtractor;
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.jcr.SessionDelegate;
 import org.apache.jackrabbit.oak.namepath.NamePathMapper;
 import org.apache.jackrabbit.oak.spi.state.ChildNodeEntry;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
@@ -41,21 +40,19 @@ import static org.apache.jackrabbit.comm
 import static org.apache.jackrabbit.oak.util.Iterators.singleton;
 
 class ChangeProcessor extends TimerTask {
-    private final SessionDelegate sessionDelegate;
+    private final NamePathMapper namePathMapper;
     private final ChangeExtractor changeExtractor;
     private final EventListener listener;
     private final AtomicReference<ChangeFilter> filterRef;
-    private final NamePathMapper namePathMapper;
 
     private volatile boolean stopped;
 
-    public ChangeProcessor(SessionDelegate sessionDelegate, ChangeExtractor changeExtractor,
EventListener listener,
+    public ChangeProcessor(NamePathMapper namePathMapper, ChangeExtractor changeExtractor,
EventListener listener,
             ChangeFilter filter) {
-        this.sessionDelegate = sessionDelegate;
+        this.namePathMapper = namePathMapper;
         this.changeExtractor = changeExtractor;
         this.listener = listener;
         filterRef = new AtomicReference<ChangeFilter>(filter);
-        namePathMapper = sessionDelegate.getNamePathMapper();
     }
 
     public void setFilter(ChangeFilter filter) {
@@ -69,7 +66,6 @@ class ChangeProcessor extends TimerTask 
 
     @Override
     public void run() {
-        sessionDelegate.refresh(true);
         EventGeneratingNodeStateDiff diff = new EventGeneratingNodeStateDiff();
         changeExtractor.getChanges(diff);
         diff.sendEvents();

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ObservationManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ObservationManagerImpl.java?rev=1360185&r1=1360184&r2=1360185&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ObservationManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/observation/ObservationManagerImpl.java
Wed Jul 11 14:19:02 2012
@@ -59,7 +59,8 @@ public class ObservationManagerImpl impl
         if (processor == null) {
             ChangeExtractor extractor = sessionDelegate.getChangeExtractor();
             ChangeFilter filter = new ChangeFilter(eventTypes, absPath, isDeep, uuid, nodeTypeName,
noLocal);
-            ChangeProcessor changeProcessor = new ChangeProcessor(sessionDelegate, extractor,
listener, filter);
+            ChangeProcessor changeProcessor = new ChangeProcessor(sessionDelegate.getNamePathMapper(),
extractor,
+                    listener, filter);
             processors.put(listener, changeProcessor);
             timer.get().schedule(changeProcessor, 0, 1000);
         }



Mime
View raw message