BUG-5280: fix problems identified by integration tests
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / actors / dds / ClientTransaction.java
index 8450c67224fb7625bffbf64d3d4741737d3049db..abb134526954f90a63c7f394ae6a91bba887c5cb 100644 (file)
@@ -152,20 +152,27 @@ public final class ClientTransaction extends LocalAbortable implements Identifia
      * Release all state associated with this transaction.
      */
     public void abort() {
-        if (ensureClosed()) {
-            for (AbstractProxyTransaction proxy : proxies.values()) {
-                proxy.abort();
-            }
-            proxies.clear();
-
+        if (commonAbort()) {
             parent.onTransactionAbort(transactionId);
         }
     }
 
+    private boolean commonAbort() {
+        if (!ensureClosed()) {
+            return false;
+        }
+
+        for (AbstractProxyTransaction proxy : proxies.values()) {
+            proxy.abort();
+        }
+        proxies.clear();
+        return true;
+    }
+
     @Override
     void localAbort(final Throwable cause) {
-        LOG.debug("Aborting transaction {}", getIdentifier(), cause);
-        abort();
+        LOG.debug("Local abort of transaction {}", getIdentifier(), cause);
+        commonAbort();
     }
 
     Map<Long, AbstractProxyTransaction> getProxies() {