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%2FNoOpTransactionContext.java;h=bfb0046ba027b809be6d53dd507d4d90eb491365;hb=546cd1fd100dbaa36908b22c2f422320dbd8c4b2;hp=a1421429405506d9c4ea1c0f0d4f848bc11c7b78;hpb=d71b6614d6cdb5a98f086edeb56f5c52f365c61c;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java index a142142940..bfb0046ba0 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java @@ -8,73 +8,52 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorSelection; -import com.google.common.base.Optional; import com.google.common.util.concurrent.SettableFuture; +import java.util.Optional; +import java.util.SortedSet; +import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; import org.opendaylight.controller.cluster.datastore.exceptions.NoShardLeaderException; -import org.opendaylight.controller.md.sal.common.api.data.DataStoreUnavailableException; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; +import org.opendaylight.controller.cluster.datastore.messages.AbstractRead; +import org.opendaylight.mdsal.common.api.DataStoreUnavailableException; +import org.opendaylight.mdsal.common.api.ReadFailedException; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import scala.concurrent.Future; -final class NoOpTransactionContext extends AbstractTransactionContext { +final class NoOpTransactionContext extends TransactionContext { private static final Logger LOG = LoggerFactory.getLogger(NoOpTransactionContext.class); private final Throwable failure; - public NoOpTransactionContext(Throwable failure, OperationLimiter limiter) { - super(limiter); + NoOpTransactionContext(final Throwable failure, final TransactionIdentifier identifier) { + super(identifier); this.failure = failure; } @Override - public void closeTransaction() { + void closeTransaction() { LOG.debug("NoOpTransactionContext {} closeTransaction called", getIdentifier()); } @Override - public boolean supportsDirectCommit() { - return true; - } - - @Override - public Future directCommit() { - LOG.debug("Tx {} directCommit called, failure: {}", getIdentifier(), failure); - releaseOperation(); + Future directCommit(final Boolean havePermit) { + LOG.debug("Tx {} directCommit called, failure", getIdentifier(), failure); return akka.dispatch.Futures.failed(failure); } @Override - public Future readyTransaction() { - LOG.debug("Tx {} readyTransaction called, failure: {}", getIdentifier(), failure); - releaseOperation(); + Future readyTransaction(final Boolean havePermit, + final Optional> participatingShardNamess) { + LOG.debug("Tx {} readyTransaction called, failure", getIdentifier(), failure); return akka.dispatch.Futures.failed(failure); } @Override - public void deleteData(YangInstanceIdentifier path) { - LOG.debug("Tx {} deleteData called path = {}", getIdentifier(), path); - releaseOperation(); - } - - @Override - public void mergeData(YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("Tx {} mergeData called path = {}", getIdentifier(), path); - releaseOperation(); - } - - @Override - public void writeData(YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("Tx {} writeData called path = {}", getIdentifier(), path); - releaseOperation(); - } - - @Override - public void readData(final YangInstanceIdentifier path, SettableFuture>> proxyFuture) { - LOG.debug("Tx {} readData called path = {}", getIdentifier(), path); - releaseOperation(); + void executeRead(final AbstractRead readCmd, final SettableFuture proxyFuture, final Boolean havePermit) { + LOG.debug("Tx {} executeRead {} called path = {}", getIdentifier(), readCmd.getClass().getSimpleName(), + readCmd.getPath()); final Throwable t; if (failure instanceof NoShardLeaderException) { @@ -82,13 +61,22 @@ final class NoOpTransactionContext extends AbstractTransactionContext { } else { t = failure; } - proxyFuture.setException(new ReadFailedException("Error reading data for path " + path, t)); + proxyFuture.setException(new ReadFailedException("Error executeRead " + readCmd.getClass().getSimpleName() + + " for path " + readCmd.getPath(), t)); + } + + @Override + void executeDelete(final YangInstanceIdentifier path, final Boolean havePermit) { + LOG.debug("Tx {} executeDelete called path = {}", getIdentifier(), path); + } + + @Override + void executeMerge(final YangInstanceIdentifier path, final NormalizedNode data, final Boolean havePermit) { + LOG.debug("Tx {} executeMerge called path = {}", getIdentifier(), path); } @Override - public void dataExists(YangInstanceIdentifier path, SettableFuture proxyFuture) { - LOG.debug("Tx {} dataExists called path = {}", getIdentifier(), path); - releaseOperation(); - proxyFuture.setException(new ReadFailedException("Error checking exists for path " + path, failure)); + void executeWrite(final YangInstanceIdentifier path, final NormalizedNode data, final Boolean havePermit) { + LOG.debug("Tx {} executeWrite called path = {}", getIdentifier(), path); } }