Author: mreutegg
Date: Wed Jun 10 08:50:06 2015
New Revision: 1684604

URL: http://svn.apache.org/r1684604
Log:
OAK-2763: Remove ChangeDispatcher in DocumentNodeStoreBranch

Merged revision 1673415 from trunk

Modified:
    jackrabbit/oak/branches/1.2/   (props changed)
    
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java

Propchange: jackrabbit/oak/branches/1.2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 10 08:50:06 2015
@@ -1,3 +1,3 @@
 /jackrabbit/oak/branches/1.0:1665962
-/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672642,1672644,1672834-1672835,1673351,1673410,1673414,1673436,1673644,1673662-1673664,1673669,1673695,1673738,1673787,1673791,1674046,1674065,1674075,1674107,1674228,1674780,1674880,1675054-1675055,1675319,1675332,1675354,1675357,1675382,1675555,1675566,1675593,1676198,1676237,1676407,1676458,1676539,1676670,1676693,1676703,1676725,1677579,1677581,1677609,1677611,1677774,1677788,1677797,1677804,1677806,1677939,1677991,1678173,1678323,1678758,1678938,1678954,1679144,1679165,1679191,1679235,1679958,1680182,1680222,1680232,1680236,1680461,1680633,1680643,1680805-1680806,1680903,1681282,1681767,1681918,1682218,1682235,1682437,1682494,1682555,1682855,1682904,1683089,1683213,1683249,1683278,1683323,1683687,1684174-1684175,1684186,1684376,1684442,1684561,1684570
+/jackrabbit/oak/trunk:1672350,1672468,1672537,1672603,1672642,1672644,1672834-1672835,1673351,1673410,1673414-1673415,1673436,1673644,1673662-1673664,1673669,1673695,1673738,1673787,1673791,1674046,1674065,1674075,1674107,1674228,1674780,1674880,1675054-1675055,1675319,1675332,1675354,1675357,1675382,1675555,1675566,1675593,1676198,1676237,1676407,1676458,1676539,1676670,1676693,1676703,1676725,1677579,1677581,1677609,1677611,1677774,1677788,1677797,1677804,1677806,1677939,1677991,1678173,1678323,1678758,1678938,1678954,1679144,1679165,1679191,1679235,1679958,1680182,1680222,1680232,1680236,1680461,1680633,1680643,1680805-1680806,1680903,1681282,1681767,1681918,1682218,1682235,1682437,1682494,1682555,1682855,1682904,1683089,1683213,1683249,1683278,1683323,1683687,1684174-1684175,1684186,1684376,1684442,1684561,1684570
 /jackrabbit/trunk:1345480

Modified: 
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java?rev=1684604&r1=1684603&r2=1684604&view=diff
==============================================================================
--- 
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
 (original)
+++ 
jackrabbit/oak/branches/1.2/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
 Wed Jun 10 08:50:06 2015
@@ -36,7 +36,6 @@ import javax.annotation.Nonnull;
 import com.google.common.collect.Maps;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
 import org.apache.jackrabbit.oak.commons.PathUtils;
-import org.apache.jackrabbit.oak.spi.commit.ChangeDispatcher;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CommitInfo;
 import org.apache.jackrabbit.oak.spi.state.ConflictAnnotatingRebaseDiff;
@@ -64,9 +63,6 @@ class DocumentNodeStoreBranch implements
     /** The underlying store to which this branch belongs */
     protected final DocumentNodeStore store;
 
-    /** The dispatcher to report changes */
-    protected final ChangeDispatcher dispatcher;
-
     protected final long maximumBackoff;
 
     /** The maximum time in milliseconds to wait for the merge lock. */
@@ -86,7 +82,6 @@ class DocumentNodeStoreBranch implements
                             DocumentNodeState base,
                             ReadWriteLock mergeLock) {
         this.store = checkNotNull(store);
-        this.dispatcher = new ChangeDispatcher(store.getRoot());
         this.branchState = new Unmodified(checkNotNull(base));
         this.maximumBackoff = Math.max((long) store.getMaxBackOffMillis(), 
MIN_BACKOFF);
         this.maxLockTryTimeMS = (long) (store.getMaxBackOffMillis() * 
MAX_LOCK_TRY_TIME_MULTIPLIER);
@@ -529,22 +524,16 @@ class DocumentNodeStoreBranch implements
                 throws CommitFailedException {
             checkNotNull(hook);
             checkNotNull(info);
+            rebase();
+            NodeState toCommit = hook.processCommit(base, head, info);
             try {
-                rebase();
-                dispatcher.contentChanged(base, null);
-                NodeState toCommit = hook.processCommit(base, head, info);
-                try {
-                    NodeState newHead = 
DocumentNodeStoreBranch.this.persist(toCommit, base, info);
-                    dispatcher.contentChanged(newHead, info);
-                    branchState = new Merged(base);
-                    return newHead;
-                } catch(DocumentStoreException e) {
-                    throw new CommitFailedException(MERGE, 1, "Failed to merge 
changes to the underlying store", e);
-                } catch (Exception e) {
-                    throw new CommitFailedException(OAK, 1, "Failed to merge 
changes to the underlying store", e);
-                }
-            } finally {
-                dispatcher.contentChanged(store.getRoot(), null);
+                NodeState newHead = 
DocumentNodeStoreBranch.this.persist(toCommit, base, info);
+                branchState = new Merged(base);
+                return newHead;
+            } catch(DocumentStoreException e) {
+                throw new CommitFailedException(MERGE, 1, "Failed to merge 
changes to the underlying store", e);
+            } catch (Exception e) {
+                throw new CommitFailedException(OAK, 1, "Failed to merge 
changes to the underlying store", e);
             }
         }
     }
@@ -573,12 +562,6 @@ class DocumentNodeStoreBranch implements
             this.head = createBranch(base);
         }
 
-        Persisted(DocumentNodeState base, DocumentNodeState head) {
-            super(base);
-            createBranch(base);
-            this.head = head;
-        }
-
         /**
          * Create a new branch state from the given state.
          *
@@ -642,7 +625,6 @@ class DocumentNodeStoreBranch implements
             try {
                 rebase();
                 previousHead = head;
-                dispatcher.contentChanged(base, null);
                 DocumentNodeState newRoot = withCurrentBranch(new 
Callable<DocumentNodeState>() {
                     @Override
                     public DocumentNodeState call() throws Exception {
@@ -653,7 +635,6 @@ class DocumentNodeStoreBranch implements
                 });
                 branchState = new Merged(base);
                 success = true;
-                dispatcher.contentChanged(newRoot, info);
                 return newRoot;
             } catch (CommitFailedException e) {
                 throw e;
@@ -664,7 +645,6 @@ class DocumentNodeStoreBranch implements
                 if (!success) {
                     resetBranch(head, previousHead);
                 }
-                dispatcher.contentChanged(store.getRoot(), null);
             }
         }
 


Reply via email to