in tm/src/main/java/org/apache/seata/tm/api/TransactionalTemplate.java [255:298]
private void rollbackTransaction(GlobalTransaction tx, Throwable originalException) throws TransactionException, TransactionalExecutor.ExecutionException {
if (tx.getGlobalTransactionRole() != GlobalTransactionRole.Launcher) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Ignore rollback: just involved in global transaction [{}]", tx.getXid());
}
return;
}
try {
triggerBeforeRollback();
tx.rollback();
triggerAfterRollback();
} catch (TransactionException txe) {
// Failed to rollback
throw new TransactionalExecutor.ExecutionException(tx, txe,
TransactionalExecutor.Code.RollbackFailure, originalException);
}
//# fix #5231
TransactionalExecutor.Code code;
switch (tx.getLocalStatus()) {
case RollbackFailed:
case TimeoutRollbackFailed:
case RollbackRetryTimeout:
code = TransactionalExecutor.Code.RollbackFailure;
break;
case Rollbacking:
case RollbackRetrying:
case TimeoutRollbacking:
case TimeoutRollbackRetrying:
code = TransactionalExecutor.Code.Rollbacking;
break;
case TimeoutRollbacked:
case Rollbacked:
//rollback transactions but do not exist are usually considered completed
case Finished:
code = TransactionalExecutor.Code.RollbackDone;
break;
default:
code = TransactionalExecutor.Code.Unknown;
LOGGER.warn("{} rollback in the state {}", tx.getXid(), tx.getLocalStatus());
}
throw new TransactionalExecutor.ExecutionException(tx, code, originalException);
}