From: Tomas Cere Date: Thu, 8 Jun 2017 09:48:00 +0000 (+0200) Subject: Catch all exceptions when submitting in tx handlers X-Git-Tag: release/carbon-sr1~34 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=31a52c56cb4e8398403f299d0c3d3830084e260e Catch all exceptions when submitting in tx handlers Change-Id: I5b9a2ec26b1b6001423f2cf5cf57285ce6c7e340 Signed-off-by: Tomas Cere --- diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java index 2c1779f2b4..81d7837124 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java @@ -139,7 +139,7 @@ public class ProduceTransactionsHandler implements Runnable { try { tx.submit().checkedGet(125, TimeUnit.SECONDS); - } catch (final TransactionCommitFailedException | TimeoutException e) { + } catch (final Exception e) { LOG.warn("Unable to fill the initial item list.", e); settableFuture.set(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build()); @@ -209,7 +209,7 @@ public class ProduceTransactionsHandler implements Runnable { .withResult(output).build()); executor.shutdown(); - } catch (InterruptedException | ExecutionException | TimeoutException exception) { + } catch (Exception exception) { LOG.error("Write transactions failed.", exception); completionFuture.set(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", exception).build()); diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/WriteTransactionsHandler.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/WriteTransactionsHandler.java index e9c5ffb6ee..7b57263157 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/WriteTransactionsHandler.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/WriteTransactionsHandler.java @@ -165,7 +165,7 @@ public class WriteTransactionsHandler implements Runnable { try { tx.submit().checkedGet(125, TimeUnit.SECONDS); - } catch (final TransactionCommitFailedException | TimeoutException e) { + } catch (final Exception e) { LOG.warn("Unable to ensure IdInts list for id: {} exists.", id, e); settableFuture.set(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build()); @@ -186,7 +186,7 @@ public class WriteTransactionsHandler implements Runnable { try { tx.submit().checkedGet(125, TimeUnit.SECONDS); - } catch (final TransactionCommitFailedException | TimeoutException e) { + } catch (final Exception e) { LOG.warn("Unable to fill the initial item list.", e); settableFuture.set(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build()); @@ -245,7 +245,7 @@ public class WriteTransactionsHandler implements Runnable { .withResult(output).build()); executor.shutdown(); - } catch (InterruptedException | ExecutionException | TimeoutException exception) { + } catch (Exception exception) { LOG.error("Write transactions failed.", exception); completionFuture.set(RpcResultBuilder.failed() .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", exception).build());