X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fcompat%2FPreLithiumTransactionContextImpl.java;h=4de8ab721f7b59e5b138df3acf2ac78f7c49bb9f;hp=ccfb32969287291b941861ecaefe1c1f25df5613;hb=c7e1ddeaf842ebb696c8dd38c0ca14c925ee31a1;hpb=edcc020c8fda4b13f22a31d79c13feef0b53b0ee diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionContextImpl.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionContextImpl.java index ccfb329692..4de8ab721f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionContextImpl.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumTransactionContextImpl.java @@ -9,8 +9,8 @@ package org.opendaylight.controller.cluster.datastore.compat; import akka.actor.ActorSelection; import org.opendaylight.controller.cluster.datastore.DataStoreVersions; -import org.opendaylight.controller.cluster.datastore.OperationCompleter; -import org.opendaylight.controller.cluster.datastore.TransactionContextImpl; +import org.opendaylight.controller.cluster.datastore.OperationLimiter; +import org.opendaylight.controller.cluster.datastore.RemoteTransactionContext; import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.messages.DeleteData; import org.opendaylight.controller.cluster.datastore.messages.MergeData; @@ -19,7 +19,6 @@ import org.opendaylight.controller.cluster.datastore.messages.WriteData; import org.opendaylight.controller.cluster.datastore.utils.ActorContext; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.concurrent.Future; @@ -30,51 +29,47 @@ import scala.concurrent.Future; * * @author Thomas Pantelis */ -public class PreLithiumTransactionContextImpl extends TransactionContextImpl { +@Deprecated +public class PreLithiumTransactionContextImpl extends RemoteTransactionContext { private static final Logger LOG = LoggerFactory.getLogger(PreLithiumTransactionContextImpl.class); private final String transactionPath; public PreLithiumTransactionContextImpl(String transactionPath, ActorSelection actor, TransactionIdentifier identifier, - String transactionChainId, ActorContext actorContext, SchemaContext schemaContext, boolean isTxActorLocal, - short remoteTransactionVersion, OperationCompleter operationCompleter) { - super(actor, identifier, transactionChainId, actorContext, schemaContext, isTxActorLocal, - remoteTransactionVersion, operationCompleter); + ActorContext actorContext, boolean isTxActorLocal, + short remoteTransactionVersion, OperationLimiter limiter) { + super(actor, identifier, actorContext, isTxActorLocal, remoteTransactionVersion, limiter); this.transactionPath = transactionPath; } @Override public void deleteData(YangInstanceIdentifier path) { - recordedOperationFutures.add(executeOperationAsync( - new DeleteData(path, getRemoteTransactionVersion()))); + executeOperationAsync(new DeleteData(path, getRemoteTransactionVersion())); } @Override public void mergeData(YangInstanceIdentifier path, NormalizedNode data) { - recordedOperationFutures.add(executeOperationAsync( - new MergeData(path, data, getRemoteTransactionVersion()))); + executeOperationAsync(new MergeData(path, data, getRemoteTransactionVersion())); } @Override public void writeData(YangInstanceIdentifier path, NormalizedNode data) { - recordedOperationFutures.add(executeOperationAsync( - new WriteData(path, data, getRemoteTransactionVersion()))); + executeOperationAsync(new WriteData(path, data, getRemoteTransactionVersion())); } @Override public Future readyTransaction() { - LOG.debug("Tx {} readyTransaction called with {} previous recorded operations pending", - identifier, recordedOperationFutures.size()); + LOG.debug("Tx {} readyTransaction called", getIdentifier()); // Send the ReadyTransaction message to the Tx actor. Future lastReplyFuture = executeOperationAsync(ReadyTransaction.INSTANCE); - return combineRecordedOperationsFutures(lastReplyFuture); + return transformReadyReply(lastReplyFuture); } @Override - protected String deserializeCohortPath(String cohortPath) { + protected Future transformReadyReply(final Future readyReplyFuture) { // In base Helium we used to return the local path of the actor which represented // a remote ThreePhaseCommitCohort. The local path would then be converted to // a remote path using this resolvePath method. To maintain compatibility with @@ -82,10 +77,20 @@ public class PreLithiumTransactionContextImpl extends TransactionContextImpl { // At some point in the future when upgrades from Helium are not supported // we could remove this code to resolvePath and just use the cohortPath as the // resolved cohortPath - if(getRemoteTransactionVersion() < DataStoreVersions.HELIUM_1_VERSION) { - return getActorContext().resolvePath(transactionPath, cohortPath); + if (getRemoteTransactionVersion() < DataStoreVersions.HELIUM_1_VERSION) { + return PreLithiumTransactionReadyReplyMapper.transform(readyReplyFuture, getActorContext(), getIdentifier(), transactionPath); + } else { + return super.transformReadyReply(readyReplyFuture); } + } - return cohortPath; + @Override + public boolean supportsDirectCommit() { + return false; + } + + @Override + public Future directCommit() { + throw new UnsupportedOperationException("directCommit is not supported for " + getClass()); } }