Skip to content

Commit

Permalink
Apply comment
Browse files Browse the repository at this point in the history
  • Loading branch information
YongGoose committed Feb 15, 2025
1 parent 932c51f commit a7a9e52
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ public class DefaultCoordinator extends AbstractTCInboundHandler implements Tran
private final GlobalStatus[] rollbackingStatuses = new GlobalStatus[] {GlobalStatus.Rollbacking};
private final GlobalStatus[] committingStatuses = new GlobalStatus[] {GlobalStatus.Committing};
private final GlobalStatus[] endStatuses = new GlobalStatus[] {GlobalStatus.Rollbacked, GlobalStatus.TimeoutRollbacked,
GlobalStatus.CommitFailed, GlobalStatus.RollbackFailed, GlobalStatus.TimeoutRollbackFailed, GlobalStatus.Finished,
GlobalStatus.CommitRetryTimeout, GlobalStatus.RollbackRetryTimeout};
GlobalStatus.CommitFailed, GlobalStatus.RollbackFailed, GlobalStatus.TimeoutRollbackFailed, GlobalStatus.Finished};

private final ThreadPoolExecutor branchRemoveExecutor;

Expand Down Expand Up @@ -673,21 +672,25 @@ protected void handleEndStatesByScheduled() {
SessionHelper.forEach(needDoRollbackedSessions, rollbackedSession -> {
try {
if (isRetryTimeout(now, MAX_ROLLBACK_RETRY_TIMEOUT, rollbackedSession.getBeginTime())) {

// commit retry timeout event
SessionHelper.endRollbackFailed(rollbackedSession, true, true);

//The function of this 'return' is 'continue'.
return;
handleEndStateSession(rollbackedSession);
}
core.doGlobalRollback(rollbackedSession, true);
} catch (TransactionException ex) {
LOGGER.error("Failed to handle rollbacked [{}] {} {}", rollbackedSession.getXid(), ex.getCode(), ex.getMessage());
}
});
rollbackedSchedule(delay);
}

private void handleEndStateSession(GlobalSession globalSession) throws TransactionException {
GlobalStatus status = globalSession.getStatus();

if (status == GlobalStatus.CommitFailed) {
SessionHelper.endCommitted(globalSession, true);
return;
}
SessionHelper.endRollbacked(globalSession, true);
}

private void rollbackedSchedule(long delay) {
syncProcessing.schedule(
() -> {
Expand Down

0 comments on commit a7a9e52

Please sign in to comment.