From 1287f2e9e30390d651bb5711028d2c92f85bd73b Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 28 Apr 2022 17:38:41 +0200 Subject: [PATCH] Use Map.entry() in PingPongTransactionChain Map.entry() is potentially more efficient, use that instead of a SimpleImmutableEntry. Change-Id: I26a27f5f36a4c57b2e21158af78e4b50a787c24c Signed-off-by: Robert Varga (cherry picked from commit dc625cb737fd87e77dc3bd0e980266f7a1c0eaee) --- .../opendaylight/mdsal/dom/spi/PingPongTransactionChain.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java index 8a342fbaa2..27c47e270b 100644 --- a/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java +++ b/dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java @@ -16,7 +16,7 @@ import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.MoreExecutors; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; -import java.util.AbstractMap.SimpleImmutableEntry; +import java.util.Map; import java.util.Map.Entry; import java.util.Optional; import java.util.concurrent.CancellationException; @@ -376,8 +376,7 @@ public final class PingPongTransactionChain implements DOMTransactionChain { // transaction chain, too. Since we just came off of a locked transaction, we do not have a ready transaction // at the moment, but there may be some transaction in-flight. So we proceed to shutdown the backend chain // and mark the fact that we should be turning its completion into a failure. - deadTx = new SimpleImmutableEntry<>(tx, new CancellationException("Transaction " + frontendTx + " canceled") - .fillInStackTrace()); + deadTx = Map.entry(tx, new CancellationException("Transaction " + frontendTx + " canceled").fillInStackTrace()); delegate.close(); } -- 2.36.6