X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FLocalThreePhaseCommitCohort.java;h=1419a520355aedf1002a4dba613e1f3707d1acd6;hb=bfb38b42aa055a2478a5972f15ca4246dee796e9;hp=569bacceaa8f600f4110ddafb106f34dbccac881;hpb=340a2d4c979ac6f8d5adff8bd9e1c9f724e7a164;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalThreePhaseCommitCohort.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalThreePhaseCommitCohort.java index 569bacceaa..1419a52035 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalThreePhaseCommitCohort.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/LocalThreePhaseCommitCohort.java @@ -12,7 +12,7 @@ import akka.dispatch.Futures; import akka.dispatch.OnComplete; import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ListenableFuture; -import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; +import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.messages.CommitTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.ReadyLocalTransaction; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; @@ -37,7 +37,7 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { private final DataTreeModification modification; private final ActorContext actorContext; private final ActorSelection leader; - private Exception operationError; + private final Exception operationError; protected LocalThreePhaseCommitCohort(final ActorContext actorContext, final ActorSelection leader, final SnapshotBackedWriteTransaction transaction, final DataTreeModification modification) { @@ -45,6 +45,7 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { this.leader = Preconditions.checkNotNull(leader); this.transaction = Preconditions.checkNotNull(transaction); this.modification = Preconditions.checkNotNull(modification); + this.operationError = null; } protected LocalThreePhaseCommitCohort(final ActorContext actorContext, final ActorSelection leader, @@ -61,15 +62,11 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { return Futures.failed(operationError); } - final ReadyLocalTransaction message = new ReadyLocalTransaction(transaction.getIdentifier().toString(), + final ReadyLocalTransaction message = new ReadyLocalTransaction(transaction.getIdentifier(), modification, immediate); return actorContext.executeOperationAsync(leader, message, actorContext.getTransactionCommitOperationTimeout()); } - void setOperationError(Exception operationError) { - this.operationError = operationError; - } - Future initiateCoordinatedCommit() { final Future messageFuture = initiateCommit(false); final Future ret = TransactionReadyReplyMapper.transform(messageFuture, actorContext, @@ -98,7 +95,7 @@ class LocalThreePhaseCommitCohort implements DOMStoreThreePhaseCommitCohort { if (failure != null) { LOG.error("Failed to prepare transaction {} on backend", transaction.getIdentifier(), failure); transactionAborted(transaction); - } else if (CommitTransactionReply.SERIALIZABLE_CLASS.isInstance(message)) { + } else if (CommitTransactionReply.isSerializedType(message)) { LOG.debug("Transaction {} committed successfully", transaction.getIdentifier()); transactionCommitted(transaction); } else {