BUG-4084: Li: Log unsuccessful submiting of write transactiion 78/25578/6
authorJozef Gloncak <jgloncak@cisco.com>
Fri, 21 Aug 2015 13:39:55 +0000 (15:39 +0200)
committerJozef Gloncak <jgloncak@cisco.com>
Fri, 28 Aug 2015 08:29:05 +0000 (08:29 +0000)
If some exception occures during transaction submiting it is
logged (until now it was silently ignored).

Change-Id: I576572949259e9dd41be3efd6bd6a0a0a07955ee
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java

index d249231757640ffbd3eec46e24621033931310ea..4706cc1df8d789a24605306c3a32c3563d5fc6eb 100644 (file)
@@ -107,7 +107,22 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable
                 LOG.trace("nothing to commit - submit returns true");
                 return true;
             }
-            wTx.submit();
+            final CheckedFuture<Void, TransactionCommitFailedException> submitFuture = wTx.submit();
+            Futures.addCallback(submitFuture, new FutureCallback<Void>() {
+                @Override
+                public void onSuccess(Void result) {
+                    //no action required
+                }
+
+                @Override
+                public void onFailure(Throwable t) {
+                    if (t instanceof TransactionCommitFailedException) {
+                        LOG.error("Transaction commit failed. {}", t);
+                    } else {
+                        LOG.error("Exception during transaction submitting. {}", t);
+                    }
+                }
+            });
             wTx = null;
         }
         return true;