X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatabroker%2FConcurrentDOMDataBroker.java;h=71cd2dc7fe2df10fa9b7f3a6e4ea037ea419f217;hp=156050485d5465a422cc268df8e48e96be076581;hb=refs%2Fchanges%2F80%2F59280%2F2;hpb=de73a66ea7e017d2a3c4805fb7714b93ca7c9285 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java index 156050485d..71cd2dc7fe 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBroker.java @@ -210,19 +210,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker { } LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, throwable); - final Exception e; - if (throwable instanceof NoShardLeaderException || throwable instanceof ShardLeaderNotRespondingException) { - e = new DataStoreUnavailableException(throwable.getMessage(), throwable); - } else if (throwable instanceof Exception) { - e = (Exception)throwable; - } else { - e = new RuntimeException("Unexpected error occurred", throwable); - } - - final TransactionCommitFailedException clientException = exMapper.apply(e); // Transaction failed - tell all cohorts to abort. - @SuppressWarnings("unchecked") ListenableFuture[] canCommitFutures = new ListenableFuture[cohorts.size()]; int index = 0; @@ -230,21 +219,28 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker { canCommitFutures[index++] = cohort.abort(); } + // Propagate the original exception + final Exception e; + if (throwable instanceof NoShardLeaderException || throwable instanceof ShardLeaderNotRespondingException) { + e = new DataStoreUnavailableException(throwable.getMessage(), throwable); + } else if (throwable instanceof Exception) { + e = (Exception)throwable; + } else { + e = new RuntimeException("Unexpected error occurred", throwable); + } + clientSubmitFuture.setException(exMapper.apply(e)); + ListenableFuture> combinedFuture = Futures.allAsList(canCommitFutures); Futures.addCallback(combinedFuture, new FutureCallback>() { @Override public void onSuccess(List notUsed) { // Propagate the original exception to the client. - clientSubmitFuture.setException(clientException); + LOG.debug("Tx: {} aborted successfully", transaction.getIdentifier()); } @Override public void onFailure(Throwable failure) { LOG.error("Tx: {} Error during Abort.", transaction.getIdentifier(), failure); - - // Propagate the original exception as that is what caused the Tx to fail and is - // what's interesting to the client. - clientSubmitFuture.setException(clientException); } }, MoreExecutors.directExecutor()); }