Bug 2347: Minor fixes to correct log output 10/12810/1
authortpantelis <tpanteli@brocade.com>
Thu, 13 Nov 2014 02:57:49 +0000 (21:57 -0500)
committertpantelis <tpanteli@brocade.com>
Thu, 13 Nov 2014 03:02:42 +0000 (22:02 -0500)
DOMConcurrentDataCommitCoordinator#handleException hard-codes the error
mapper to CAN_COMMIT_ERROR_MAPPER however this should be passed
in corresponding to the phase.

In TransactionCommitFailedExceptionMapper, the opNames for
PRE_COMMIT_MAPPER and CAN_COMMIT_ERROR_MAPPER are reversed, should be
"preCommit", "canCommit" respectively.

Change-Id: I6c0513f0f6265ec19de39476c95efefee53d2ee1
Signed-off-by: tpantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMConcurrentDataCommitCoordinator.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/TransactionCommitFailedExceptionMapper.java

index 25bf228..d8a7a00 100644 (file)
@@ -95,7 +95,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
             public void onSuccess(Boolean result) {
                 if (result == null || !result) {
                     handleException(clientSubmitFuture, transaction, cohorts, cohortSize,
-                            CAN_COMMIT, new TransactionCommitFailedException(
+                            CAN_COMMIT, TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER,
+                            new TransactionCommitFailedException(
                                             "Can Commit failed, no detailed cause available."));
                 } else {
                     if(remaining.decrementAndGet() == 0) {
@@ -107,7 +108,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
 
             @Override
             public void onFailure(Throwable t) {
-                handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT, t);
+                handleException(clientSubmitFuture, transaction, cohorts, cohortSize, CAN_COMMIT,
+                        TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER, t);
             }
         };
 
@@ -134,7 +136,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
 
             @Override
             public void onFailure(Throwable t) {
-                handleException(clientSubmitFuture, transaction, cohorts, cohortSize, PRE_COMMIT, t);
+                handleException(clientSubmitFuture, transaction, cohorts, cohortSize, PRE_COMMIT,
+                        TransactionCommitFailedExceptionMapper.PRE_COMMIT_MAPPER, t);
             }
         };
 
@@ -163,7 +166,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
 
             @Override
             public void onFailure(Throwable t) {
-                handleException(clientSubmitFuture, transaction, cohorts, cohortSize, COMMIT, t);
+                handleException(clientSubmitFuture, transaction, cohorts, cohortSize, COMMIT,
+                        TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, t);
             }
         };
 
@@ -176,7 +180,8 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
     private void handleException(final AsyncNotifyingSettableFuture clientSubmitFuture,
             final DOMDataWriteTransaction transaction,
             final Iterable<DOMStoreThreePhaseCommitCohort> cohorts, int cohortSize,
-            final String phase, final Throwable t) {
+            final String phase, final TransactionCommitFailedExceptionMapper exMapper,
+            final Throwable t) {
 
         if(clientSubmitFuture.isDone()) {
             // We must have had failures from multiple cohorts.
@@ -191,8 +196,7 @@ public class DOMConcurrentDataCommitCoordinator implements DOMDataCommitExecutor
             e = new RuntimeException("Unexpected error occurred", t);
         }
 
-        final TransactionCommitFailedException clientException =
-                TransactionCommitFailedExceptionMapper.CAN_COMMIT_ERROR_MAPPER.apply(e);
+        final TransactionCommitFailedException clientException = exMapper.apply(e);
 
         // Transaction failed - tell all cohorts to abort.
 
index 799a8a0..3b5c353 100644 (file)
@@ -18,9 +18,9 @@ import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
 final class TransactionCommitFailedExceptionMapper
                            extends ExceptionMapper<TransactionCommitFailedException> {
 
-    static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("canCommit");
+    static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("preCommit");
 
-    static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("preCommit");
+    static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("canCommit");
 
     static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");