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%2FRemoteTransactionContextSupport.java;h=5bafef8a854af9bfed716bdc4a220b8c53998fe5;hb=5e7cf2452ef634dc934a3ea5a2dd95059fbab68c;hp=4f41d8902e029dc97b99b9cb385e47682e076f7b;hpb=c796596b5c46b5203c30b143e6282662e66c5642;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java index 4f41d8902e..5bafef8a85 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java @@ -21,7 +21,6 @@ import org.opendaylight.controller.cluster.datastore.messages.CreateTransaction; import org.opendaylight.controller.cluster.datastore.messages.CreateTransactionReply; import org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; -import org.opendaylight.controller.cluster.datastore.utils.TransactionIdentifierUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.concurrent.Future; @@ -31,7 +30,7 @@ import scala.concurrent.duration.FiniteDuration; * Handles creation of TransactionContext instances for remote transactions. This class creates * remote transactions, if necessary, by sending CreateTransaction messages with retries, up to a limit, * if the shard doesn't have a leader yet. This is done by scheduling a retry task after a short delay. - *
+ *
* The end result from a completed CreateTransaction message is a TransactionContext that is * used to perform transaction operations. Transaction operations that occur before the * CreateTransaction completes are cache via a TransactionContextWrapper and executed once the @@ -60,8 +59,8 @@ final class RemoteTransactionContextSupport { private final TransactionContextWrapper transactionContextWrapper; - RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper, final TransactionProxy parent, - final String shardName) { + RemoteTransactionContextSupport(final TransactionContextWrapper transactionContextWrapper, + final TransactionProxy parent, final String shardName) { this.parent = Preconditions.checkNotNull(parent); this.shardName = shardName; this.transactionContextWrapper = transactionContextWrapper; @@ -101,8 +100,8 @@ final class RemoteTransactionContextSupport { void setPrimaryShard(PrimaryShardInfo primaryShardInfo) { this.primaryShardInfo = primaryShardInfo; - if (getTransactionType() == TransactionType.WRITE_ONLY && - getActorContext().getDatastoreContext().isWriteOnlyTransactionOptimizationsEnabled()) { + if (getTransactionType() == TransactionType.WRITE_ONLY + && getActorContext().getDatastoreContext().isWriteOnlyTransactionOptimizationsEnabled()) { ActorSelection primaryShard = primaryShardInfo.getPrimaryShardActor(); LOG.debug("Tx {} Primary shard {} found - creating WRITE_ONLY transaction context", @@ -118,25 +117,13 @@ final class RemoteTransactionContextSupport { } /** - * @deprecated Temporary utility for extracting transaction chain ID from a {@link TransactionIdentifier} - */ - @Deprecated - static String compatTransactionChainId(final TransactionIdentifier txId) { - final long historyId = txId.getHistoryId().getHistoryId(); - return historyId == 0 ? "" : Long.toUnsignedString(historyId); - } - - /** - * Performs a CreateTransaction try async. + Performs a CreateTransaction try async. */ private void tryCreateTransaction() { - if(LOG.isDebugEnabled()) { - LOG.debug("Tx {} Primary shard {} found - trying create transaction", getIdentifier(), - primaryShardInfo.getPrimaryShardActor()); - } + LOG.debug("Tx {} Primary shard {} found - trying create transaction", getIdentifier(), + primaryShardInfo.getPrimaryShardActor()); - Object serializedCreateMessage = new CreateTransaction(TransactionIdentifierUtils.actorNameFor(getIdentifier()), - getTransactionType().ordinal(), compatTransactionChainId(getIdentifier()), + Object serializedCreateMessage = new CreateTransaction(getIdentifier(), getTransactionType().ordinal(), primaryShardInfo.getPrimaryShardVersion()).toSerializable(); Future