Bug 6284 - Cancellation exceptions during operation execution 75/42675/3
authorAnil Vishnoi <vishnoianil@gmail.com>
Thu, 28 Jul 2016 07:27:13 +0000 (00:27 -0700)
committerAnil Vishnoi <vishnoianil@gmail.com>
Thu, 28 Jul 2016 23:25:45 +0000 (23:25 +0000)
Change-Id: Icacfa535dc4ac3aa146ab73d363a9888542e3a8e
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
library/impl/src/main/java/org/opendaylight/ovsdb/lib/jsonrpc/JsonRpcEndpoint.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/TransactInvokerImpl.java

index f4787d31b99d52ee51b433169b71bcef69a4987b..d9f6dfdb40c87e469999865b1c9c8619dc08c68e 100644 (file)
@@ -123,10 +123,13 @@ public class JsonRpcEndpoint {
                 FUTURE_REAPER_SERVICE.schedule(new Runnable() {
                     @Override
                     public void run() {
-                        if (sf.isDone() || sf.isCancelled()) {
-                            return;
+                        CallContext cc = methodContext.remove(request.getId());
+                        if ( cc != null) {
+                            if ( cc.getFuture().isDone() || cc.getFuture().isCancelled()) {
+                                return;
+                            }
+                            cc.getFuture().cancel(false);
                         }
-                        methodContext.remove(request.getId()).getFuture().cancel(false);
                     }
                 },REAPER_INTERVAL, TimeUnit.MILLISECONDS);
 
index 95ef4028de444dc844e1f84e3498ebdca05049ab..92ba86b2aff44d71cacdb2e30a74a512ca0bb34d 100644 (file)
@@ -55,13 +55,16 @@ public class TransactInvokerImpl implements TransactInvoker {
         LOG.debug("invoke: command: {}, tb: {}", command, tb);
         if (tb.getOperations().size() > 0) {
             try {
-                List<OperationResult> got = result.get();
-                LOG.debug("OVSDB transaction result: {}", got);
+                if (!result.isCancelled()) {
+                    List<OperationResult> got = result.get();
+                    LOG.debug("OVSDB transaction result: {}", got);
+                } else {
+                    LOG.debug("Operation task cancelled for transaction : {}", tb);
+                }
             } catch (InterruptedException | ExecutionException e) {
                 LOG.warn("Transact execution exception: ", e);
             }
             LOG.trace("invoke exit command: {}, tb: {}", command, tb);
         }
     }
-
 }