Fix a nullability warning in PingPongTransactionChain 58/100858/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 07:54:33 +0000 (09:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 07:54:33 +0000 (09:54 +0200)
Eclipse is flagging multiple accessed to the same field. The field
cannot move on us, but use a local variable to make the value invariant.

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

index 1cda6b08f57de65feb225dff19ed5b622963ab86..ec2b5a2d5eacc3d4b7f70dc93061992217ca16df 100644 (file)
@@ -267,12 +267,15 @@ public final class PingPongTransactionChain implements DOMTransactionChain {
         checkState(success, "Completed transaction %s while %s was submitted", tx, inflightTx);
 
         final PingPongTransaction nextTx = READY_UPDATER.getAndSet(this, null);
-        if (nextTx != null) {
+        if (nextTx == null) {
+            final PingPongTransaction local = shutdownTx;
+            if (local != null) {
+                processTransaction(local);
+                delegate.close();
+                shutdownTx = null;
+            }
+        } else {
             processTransaction(nextTx);
-        } else if (shutdownTx != null) {
-            processTransaction(shutdownTx);
-            delegate.close();
-            shutdownTx = null;
         }
     }