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>
public void onSuccess(Boolean result) {
if (result == null || !result) {
handleException(clientSubmitFuture, transaction, cohorts, cohortSize,
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) {
"Can Commit failed, no detailed cause available."));
} else {
if(remaining.decrementAndGet() == 0) {
@Override
public void onFailure(Throwable t) {
@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);
@Override
public void onFailure(Throwable t) {
@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);
@Override
public void onFailure(Throwable t) {
@Override
public void onFailure(Throwable t) {
- handleException(clientSubmitFuture, transaction, cohorts, cohortSize, COMMIT, t);
+ handleException(clientSubmitFuture, transaction, cohorts, cohortSize, COMMIT,
+ TransactionCommitFailedExceptionMapper.COMMIT_ERROR_MAPPER, t);
private void handleException(final AsyncNotifyingSettableFuture clientSubmitFuture,
final DOMDataWriteTransaction transaction,
final Iterable<DOMStoreThreePhaseCommitCohort> cohorts, int cohortSize,
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.
if(clientSubmitFuture.isDone()) {
// We must have had failures from multiple cohorts.
e = new RuntimeException("Unexpected error occurred", t);
}
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.
// Transaction failed - tell all cohorts to abort.
final class TransactionCommitFailedExceptionMapper
extends ExceptionMapper<TransactionCommitFailedException> {
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");
static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");