Use Map.entry() in PingPongTransactionChain 68/100868/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 15:38:41 +0000 (17:38 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 15:38:41 +0000 (17:38 +0200)
Map.entry() is potentially more efficient, use that instead of a
SimpleImmutableEntry.

Change-Id: I26a27f5f36a4c57b2e21158af78e4b50a787c24c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
dom/mdsal-dom-spi/src/main/java/org/opendaylight/mdsal/dom/spi/PingPongTransactionChain.java

index 8a342fbaa2b3a9c0ad5010cd924d5ac90c23de3b..27c47e270b3aae3fc5370c11446fe55d9d3c2af4 100644 (file)
@@ -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();
     }