From: Robert Varga Date: Thu, 28 Apr 2022 07:54:33 +0000 (+0200) Subject: Fix a nullability warning in PingPongTransactionChain X-Git-Tag: v8.0.14~9 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=mdsal.git;a=commitdiff_plain;h=d4cf81199fce5c2f8a750756b95abe1d5424f0b7 Fix a nullability warning in PingPongTransactionChain 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 (cherry picked from commit 069b1e6e991e6d6ebe99621d201984a01c36bab0) (cherry picked from commit a5b5d9b7882531440d4c7335cd917b1e00075bc1) --- 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 1cda6b08f5..ec2b5a2d5e 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 @@ -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; } }