You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by mr...@apache.org on 2015/04/14 14:11:05 UTC
svn commit: r1673415 -
/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
Author: mreutegg
Date: Tue Apr 14 12:11:04 2015
New Revision: 1673415
URL: http://svn.apache.org/r1673415
Log:
OAK-2763: Remove ChangeDispatcher in DocumentNodeStoreBranch
Modified:
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java?rev=1673415&r1=1673414&r2=1673415&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreBranch.java Tue Apr 14 12:11:04 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);
@@ -540,22 +535,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);
}
}
}
@@ -584,12 +573,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.
*
@@ -653,7 +636,6 @@ class DocumentNodeStoreBranch implements
try {
rebase();
previousHead = head;
- dispatcher.contentChanged(base, null);
DocumentNodeState newRoot = withCurrentBranch(new Callable<DocumentNodeState>() {
@Override
public DocumentNodeState call() throws Exception {
@@ -664,7 +646,6 @@ class DocumentNodeStoreBranch implements
});
branchState = new Merged(base);
success = true;
- dispatcher.contentChanged(newRoot, info);
return newRoot;
} catch (CommitFailedException e) {
throw e;
@@ -675,7 +656,6 @@ class DocumentNodeStoreBranch implements
if (!success) {
resetBranch(head, previousHead);
}
- dispatcher.contentChanged(store.getRoot(), null);
}
}