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%2Fmessages%2FForwardedReadyTransaction.java;h=529b7e2153cb63888387b9a86dee36fd85aa3c95;hb=0fdb21f91e0e61e8ee911beb4cda9053537a0ccd;hp=4f8ea51f784ea2e0352eb6aedd8d1dc35469f0ef;hpb=0eba94d9411ea40945ddc8c732640c0cc004599f;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java index 4f8ea51f78..529b7e2153 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/messages/ForwardedReadyTransaction.java @@ -7,8 +7,13 @@ */ package org.opendaylight.controller.cluster.datastore.messages; -import org.opendaylight.controller.cluster.datastore.modification.Modification; -import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort; +import static java.util.Objects.requireNonNull; + +import java.util.Optional; +import java.util.SortedSet; +import javax.annotation.Nullable; +import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; +import org.opendaylight.controller.cluster.datastore.ReadWriteShardDataTreeTransaction; /** * Transaction ReadyTransaction message that is forwarded to the local Shard from the ShardTransaction. @@ -16,26 +21,47 @@ import org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCoh * @author Thomas Pantelis */ public class ForwardedReadyTransaction { - private final String transactionID; - private final DOMStoreThreePhaseCommitCohort cohort; - private final Modification modification; - - public ForwardedReadyTransaction(String transactionID, DOMStoreThreePhaseCommitCohort cohort, - Modification modification) { - this.transactionID = transactionID; - this.cohort = cohort; - this.modification = modification; + private final TransactionIdentifier transactionId; + private final ReadWriteShardDataTreeTransaction transaction; + private final boolean doImmediateCommit; + private final short txnClientVersion; + @Nullable + private final SortedSet participatingShardNames; + + public ForwardedReadyTransaction(TransactionIdentifier transactionId, short txnClientVersion, + ReadWriteShardDataTreeTransaction transaction, boolean doImmediateCommit, + Optional> participatingShardNames) { + this.transactionId = requireNonNull(transactionId); + this.transaction = requireNonNull(transaction); + this.txnClientVersion = txnClientVersion; + this.doImmediateCommit = doImmediateCommit; + this.participatingShardNames = requireNonNull(participatingShardNames).orElse(null); + } + + public TransactionIdentifier getTransactionId() { + return transactionId; + } + + public ReadWriteShardDataTreeTransaction getTransaction() { + return transaction; + } + + public short getTxnClientVersion() { + return txnClientVersion; } - public String getTransactionID() { - return transactionID; + public boolean isDoImmediateCommit() { + return doImmediateCommit; } - public DOMStoreThreePhaseCommitCohort getCohort() { - return cohort; + public Optional> getParticipatingShardNames() { + return Optional.ofNullable(participatingShardNames); } - public Modification getModification() { - return modification; + @Override + public String toString() { + return "ForwardedReadyTransaction [transactionId=" + transactionId + ", transaction=" + transaction + + ", doImmediateCommit=" + doImmediateCommit + ", participatingShardNames=" + participatingShardNames + + ", txnClientVersion=" + txnClientVersion + "]"; } }