Fix a nullability warning in PingPongTransactionChain 66/101066/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 28 Apr 2022 07:54:33 +0000 (09:54 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 11 May 2022 11:51:49 +0000 (13:51 +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>
(cherry picked from commit 069b1e6e991e6d6ebe99621d201984a01c36bab0)
(cherry picked from commit a5b5d9b7882531440d4c7335cd917b1e00075bc1)

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;
         }
     }