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=197cd9fa83c00b569b25d59d982328774fb44436;hb=34e38a415bc299403657315a5b61afd432dcbbee;hp=fc10b9c23b215fd37012e75549a7b997bf41434f;hpb=37f0504d391efd8b7d61403759fcc22a6dd3a093;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 fc10b9c23b..197cd9fa83 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 @@ -9,8 +9,7 @@ package org.opendaylight.controller.cluster.datastore; import akka.actor.ActorSelection; import com.google.common.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; -import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.SettableFuture; import java.util.concurrent.Semaphore; import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; @@ -34,49 +33,57 @@ final class NoOpTransactionContext extends AbstractTransactionContext { @Override public void closeTransaction() { - LOG.debug("NoOpTransactionContext {} closeTransaction called", identifier); + LOG.debug("NoOpTransactionContext {} closeTransaction called", getIdentifier()); + } + + @Override + public boolean supportsDirectCommit() { + return true; + } + + @Override + public Future directCommit() { + LOG.debug("Tx {} directCommit called, failure: {}", getIdentifier(), failure); + operationLimiter.release(); + return akka.dispatch.Futures.failed(failure); } @Override public Future readyTransaction() { - LOG.debug("Tx {} readyTransaction called", identifier); + LOG.debug("Tx {} readyTransaction called, failure: {}", getIdentifier(), failure); operationLimiter.release(); return akka.dispatch.Futures.failed(failure); } @Override public void deleteData(YangInstanceIdentifier path) { - LOG.debug("Tx {} deleteData called path = {}", identifier, path); + LOG.debug("Tx {} deleteData called path = {}", getIdentifier(), path); operationLimiter.release(); } @Override public void mergeData(YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("Tx {} mergeData called path = {}", identifier, path); + LOG.debug("Tx {} mergeData called path = {}", getIdentifier(), path); operationLimiter.release(); } @Override public void writeData(YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("Tx {} writeData called path = {}", identifier, path); + LOG.debug("Tx {} writeData called path = {}", getIdentifier(), path); operationLimiter.release(); } @Override - public CheckedFuture>, ReadFailedException> readData( - YangInstanceIdentifier path) { - LOG.debug("Tx {} readData called path = {}", identifier, path); + public void readData(final YangInstanceIdentifier path, SettableFuture>> proxyFuture) { + LOG.debug("Tx {} readData called path = {}", getIdentifier(), path); operationLimiter.release(); - return Futures.immediateFailedCheckedFuture(new ReadFailedException( - "Error reading data for path " + path, failure)); + proxyFuture.setException(new ReadFailedException("Error reading data for path " + path, failure)); } @Override - public CheckedFuture dataExists( - YangInstanceIdentifier path) { - LOG.debug("Tx {} dataExists called path = {}", identifier, path); + public void dataExists(YangInstanceIdentifier path, SettableFuture proxyFuture) { + LOG.debug("Tx {} dataExists called path = {}", getIdentifier(), path); operationLimiter.release(); - return Futures.immediateFailedCheckedFuture(new ReadFailedException( - "Error checking exists for path " + path, failure)); + proxyFuture.setException(new ReadFailedException("Error checking exists for path " + path, failure)); } -} \ No newline at end of file +}