2020import org .apache .seata .core .model .GlobalStatus ;
2121import org .apache .seata .server .console .exception .ConsoleException ;
2222import org .apache .seata .server .console .service .GlobalSessionService ;
23- import org .apache .seata .server .coordinator .DefaultCoordinator ;
2423import org .apache .seata .server .session .BranchSession ;
2524import org .apache .seata .server .session .GlobalSession ;
26- import org .apache .seata .server .session .SessionHolder ;
2725
2826import java .util .ArrayList ;
2927import java .util .List ;
@@ -121,21 +119,10 @@ public SingleResult<Void> sendCommitOrRollback(String xid) {
121119 boolean res ;
122120 if (RETRY_COMMIT_STATUS .contains (globalStatus ) || GlobalStatus .Committing .equals (globalStatus )
123121 || GlobalStatus .StopCommitOrCommitRetry .equals (globalStatus )) {
124- res = DefaultCoordinator .getInstance ().doGlobalCommit (globalSession , false );
125- if (res && globalSession .hasBranch () && globalSession .hasATBranch ()) {
126- globalSession .clean ();
127- globalSession .asyncCommit ();
128- } else if (res && SessionHolder .findGlobalSession (xid ) != null ) {
129- globalSession .end ();
130- }
122+ res = doRetryCommitGlobal (globalSession );
131123 } else if (RETRY_ROLLBACK_STATUS .contains (globalStatus ) || GlobalStatus .Rollbacking .equals (globalStatus )
132124 || GlobalStatus .StopRollbackOrRollbackRetry .equals (globalStatus )) {
133- res = DefaultCoordinator .getInstance ().doGlobalRollback (globalSession , false );
134- // the record is not deleted
135- if (res && SessionHolder .findGlobalSession (xid ) != null ) {
136- globalSession .changeGlobalStatus (GlobalStatus .Rollbacked );
137- globalSession .end ();
138- }
125+ res = doRetryRollbackGlobal (globalSession );
139126 } else {
140127 throw new IllegalArgumentException ("current global transaction status is not support to do" );
141128 }
@@ -152,11 +139,11 @@ public SingleResult<Void> changeGlobalStatus(String xid) {
152139 GlobalStatus globalStatus = globalSession .getStatus ();
153140 try {
154141 if (FAIL_COMMIT_STATUS .contains (globalStatus )) {
155- boolean committed = doCommitGlobal (globalSession );
142+ boolean committed = doRetryCommitGlobal (globalSession );
156143 return committed ? SingleResult .success () : SingleResult .failure ("Commit fail, please try again" );
157144 }
158145 if (FAIL_ROLLBACK_STATUS .contains (globalStatus )) {
159- boolean rollbacked = doRollbackGlobal (globalSession );
146+ boolean rollbacked = doRetryRollbackGlobal (globalSession );
160147 return rollbacked ? SingleResult .success () : SingleResult .failure ("Rollback fail, please try again" );
161148 }
162149 } catch (Exception e ) {
0 commit comments