Catch all exceptions when submitting in tx handlers
[controller.git] / opendaylight / md-sal / samples / clustering-test-app / provider / src / main / java / org / opendaylight / controller / clustering / it / provider / impl / ProduceTransactionsHandler.java
index 7ce2b8ded6562b6df6df571ca4c87dd2f14b7348..01be4645bccb62e719b745a80e4d5ef3e41de564 100644 (file)
@@ -57,7 +57,7 @@ public class ProduceTransactionsHandler implements Runnable {
 
     static final QName ID_INTS =
             QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "id-ints");
-    static final QName ID_INT =
+    public static final QName ID_INT =
             QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "id-int");
     static final QName ID =
             QName.create("tag:opendaylight.org,2017:controller:yang:lowlevel:target", "2017-02-15", "id");
@@ -124,11 +124,6 @@ public class ProduceTransactionsHandler implements Runnable {
         LOG.debug("Filling the item list with initial values.");
 
         final CollectionNodeBuilder<MapEntryNode, MapNode> mapBuilder = ImmutableNodes.mapNodeBuilder(ITEM);
-        for (int i = 0; i < MAX_ITEM / 2; i++) {
-            usedValues.add(i);
-            mapBuilder.withChild(ImmutableNodes.mapEntry(ITEM, NUMBER, i));
-        }
-
         idListWithKey = ID_INT_YID.node(new NodeIdentifierWithPredicates(ID_INT, ID, id));
 
         itemProducer = domDataTreeService.createProducer(
@@ -144,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.<ProduceTransactionsOutput>failed()
                     .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", e).build());
@@ -208,7 +203,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.<ProduceTransactionsOutput>failed()
                         .withError(RpcError.ErrorType.APPLICATION, "Unexpected-exception", exception).build());