Fix warnings/javadocs in sal-distributed-datastore
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / main / java / org / opendaylight / controller / cluster / databroker / ConcurrentDOMDataBroker.java
index bdaa6db6c1a1f1d3fc08b10c25f8f83ee27b5a60..2eeb955b4fe3b782f86c551a084bad15a2e9ac1e 100644 (file)
@@ -59,12 +59,13 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
      */
     private final Executor clientFutureCallbackExecutor;
 
-    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, Executor listenableFutureExecutor) {
+    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
+            Executor listenableFutureExecutor) {
         this(datastores, listenableFutureExecutor, DurationStatisticsTracker.createConcurrent());
     }
 
-    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores, Executor listenableFutureExecutor,
-            DurationStatisticsTracker commitStatsTracker) {
+    public ConcurrentDOMDataBroker(final Map<LogicalDatastoreType, DOMStore> datastores,
+            Executor listenableFutureExecutor, DurationStatisticsTracker commitStatsTracker) {
         super(datastores);
         this.clientFutureCallbackExecutor = Preconditions.checkNotNull(listenableFutureExecutor);
         this.commitStatsTracker = Preconditions.checkNotNull(commitStatsTracker);
@@ -82,7 +83,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
         Preconditions.checkArgument(cohorts != null, "Cohorts must not be null.");
         LOG.debug("Tx: {} is submitted for execution.", transaction.getIdentifier());
 
-        if(cohorts.isEmpty()){
+        if (cohorts.isEmpty()) {
             return Futures.immediateCheckedFuture(null);
         }
 
@@ -113,7 +114,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
                             new TransactionCommitFailedException(
                                             "Can Commit failed, no detailed cause available."));
                 } else {
-                    if(!cohortIterator.hasNext()) {
+                    if (!cohortIterator.hasNext()) {
                         // All cohorts completed successfully - we can move on to the preCommit phase
                         doPreCommit(startTime, clientSubmitFuture, transaction, cohorts);
                     } else {
@@ -124,9 +125,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 handleException(clientSubmitFuture, transaction, cohorts, CAN_COMMIT,
-                        TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, t);
+                        TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, failure);
             }
         };
 
@@ -144,7 +145,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
         FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
-                if(!cohortIterator.hasNext()) {
+                if (!cohortIterator.hasNext()) {
                     // All cohorts completed successfully - we can move on to the commit phase
                     doCommit(startTime, clientSubmitFuture, transaction, cohorts);
                 } else {
@@ -154,9 +155,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable failure) {
                 handleException(clientSubmitFuture, transaction, cohorts, PRE_COMMIT,
-                        TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, t);
+                        TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, failure);
             }
         };
 
@@ -174,7 +175,7 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
         FutureCallback<Void> futureCallback = new FutureCallback<Void>() {
             @Override
             public void onSuccess(Void notUsed) {
-                if(!cohortIterator.hasNext()) {
+                if (!cohortIterator.hasNext()) {
                     // All cohorts completed successfully - we're done.
                     commitStatsTracker.addDuration(System.nanoTime() - startTime);
 
@@ -186,9 +187,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
-            public void onFailure(Throwable t) {
+            public void onFailure(Throwable throwable) {
                 handleException(clientSubmitFuture, transaction, cohorts, COMMIT,
-                        TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, t);
+                        TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, throwable);
             }
         };
 
@@ -200,21 +201,21 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             final DOMDataWriteTransaction transaction,
             final Collection<DOMStoreThreePhaseCommitCohort> cohorts,
             final String phase, final TransactionCommitFailedExceptionMapper exMapper,
-            final Throwable t) {
+            final Throwable throwable) {
 
         if (clientSubmitFuture.isDone()) {
             // We must have had failures from multiple cohorts.
             return;
         }
 
-        LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, t);
+        LOG.warn("Tx: {} Error during phase {}, starting Abort", transaction.getIdentifier(), phase, throwable);
         final Exception e;
-        if(t instanceof NoShardLeaderException || t instanceof ShardLeaderNotRespondingException) {
-            e = new DataStoreUnavailableException(t.getMessage(), t);
-        } else if (t instanceof Exception) {
-            e = (Exception)t;
+        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", t);
+            e = new RuntimeException("Unexpected error occurred", throwable);
         }
 
         final TransactionCommitFailedException clientException = exMapper.apply(e);
@@ -223,9 +224,9 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
 
         @SuppressWarnings("unchecked")
         ListenableFuture<Void>[] canCommitFutures = new ListenableFuture[cohorts.size()];
-        int i = 0;
+        int index = 0;
         for (DOMStoreThreePhaseCommitCohort cohort : cohorts) {
-            canCommitFutures[i++] = cohort.abort();
+            canCommitFutures[index++] = cohort.abort();
         }
 
         ListenableFuture<List<Void>> combinedFuture = Futures.allAsList(canCommitFutures);
@@ -237,8 +238,8 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
             }
 
             @Override
-            public void onFailure(Throwable t) {
-                LOG.error("Tx: {} Error during Abort.", transaction.getIdentifier(), t);
+            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.
@@ -254,7 +255,6 @@ public class ConcurrentDOMDataBroker extends AbstractDOMBroker implements DOMDat
      * the thread that completed this future, as a common use case is to pass an executor that runs
      * tasks in the same thread as the caller (ie MoreExecutors#sameThreadExecutor)
      * to {@link #addListener}.
-     *
      * FIXME: This class should probably be moved to yangtools common utils for re-usability and
      * unified with AsyncNotifyingListenableFutureTask.
      */