From: Robert Varga Date: Thu, 24 Aug 2017 11:10:58 +0000 (+0200) Subject: Fix deprecation warning in PingPongTransactionChain X-Git-Tag: release/oxygen~134 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=ac1f509fd8cfcf4c62c6edf6609e6c0019a4bb07 Fix deprecation warning in PingPongTransactionChain Add MoreExecutors.directExecutor(). Also fix up formatting. Change-Id: I4dcc849c643713b738f2d99b1250848e46fbe82a Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java index df0dbcd77d..7a9f5e3e69 100644 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java +++ b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/PingPongTransactionChain.java @@ -14,6 +14,7 @@ import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.MoreExecutors; import java.util.AbstractMap.SimpleImmutableEntry; import java.util.Map.Entry; import java.util.concurrent.CancellationException; @@ -242,7 +243,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain { public void onFailure(final Throwable t) { transactionFailed(tx, t); } - }); + }, MoreExecutors.directExecutor()); } /* @@ -329,7 +330,6 @@ public final class PingPongTransactionChain implements DOMTransactionChain { * @param tx Backend shared transaction * @param frontendTx * @param isOpen indicator whether the transaction was already closed - * @return True if cancellation succeeded, false otherwise */ synchronized void cancelTransaction(final PingPongTransaction tx, final DOMDataReadWriteTransaction frontendTx) { // Attempt to unlock the operation. @@ -370,7 +370,8 @@ public final class PingPongTransactionChain implements DOMTransactionChain { @Override public synchronized void close() { final PingPongTransaction notLocked = lockedTx; - Preconditions.checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", notLocked); + Preconditions.checkState(notLocked == null, "Attempted to close chain with outstanding transaction %s", + notLocked); // This is not reliable, but if we observe it to be null and the process has already completed, // the backend transaction chain will throw the appropriate error. @@ -409,8 +410,8 @@ public final class PingPongTransactionChain implements DOMTransactionChain { return new DOMDataReadOnlyTransaction() { @Override - public CheckedFuture>, ReadFailedException> read(final LogicalDatastoreType store, - final YangInstanceIdentifier path) { + public CheckedFuture>, ReadFailedException> read( + final LogicalDatastoreType store, final YangInstanceIdentifier path) { return tx.getTransaction().read(store, path); }