@@ -74,8 +74,8 @@ public Object execute(TransactionalExecutor business) throws Throwable {
7474 // If transaction is existing, suspend it, and then begin new transaction.
7575 if (existingTransaction (tx )) {
7676 suspendedResourcesHolder = tx .suspend (false );
77- tx = GlobalTransactionContext .createNew ();
7877 }
78+ tx = GlobalTransactionContext .createNew ();
7979 // Continue and execute with new transaction
8080 break ;
8181 case SUPPORTS :
@@ -86,8 +86,8 @@ public Object execute(TransactionalExecutor business) throws Throwable {
8686 // Continue and execute with new transaction
8787 break ;
8888 case REQUIRED :
89- // If current transaction is existing, execute with current transaction,
90- // else continue and execute with new transaction.
89+ // If current transaction is existing, execute with current transaction,else create
90+ tx = GlobalTransactionContext . getCurrentOrCreate ();
9191 break ;
9292 case NEVER :
9393 // If transaction is existing, throw exception.
@@ -110,13 +110,12 @@ public Object execute(TransactionalExecutor business) throws Throwable {
110110 throw new TransactionException ("Not Supported Propagation:" + propagation );
111111 }
112112
113- // 1.3 If null, create new transaction with role 'GlobalTransactionRole.Launcher'.
114- if (tx == null ) {
115- tx = GlobalTransactionContext .createNew ();
116- }
117-
118113 // set current tx config to holder
119114 GlobalLockConfig previousConfig = replaceGlobalLockConfig (txInfo );
115+
116+ if (tx .getGlobalTransactionRole () == GlobalTransactionRole .Participant ) {
117+ LOGGER .info ("join into a existing global transaction,xid={}" , tx .getXid ());
118+ }
120119
121120 try {
122121 // 2. If the tx role is 'GlobalTransactionRole.Launcher', send the request of beginTransaction to TC,
@@ -211,9 +210,6 @@ private void commitTransaction(GlobalTransaction tx, TransactionInfo txInfo)
211210
212211 try {
213212 triggerBeforeCommit ();
214- if (LOGGER .isInfoEnabled ()) {
215- LOGGER .info ("transaction {} will be commit" , tx .getXid ());
216- }
217213 tx .commit ();
218214 GlobalStatus afterCommitStatus = tx .getLocalStatus ();
219215 TransactionalExecutor .Code code = TransactionalExecutor .Code .Unknown ;
@@ -252,10 +248,6 @@ private void rollbackTransaction(GlobalTransaction tx, Throwable originalExcepti
252248
253249 try {
254250 triggerBeforeRollback ();
255- if (LOGGER .isInfoEnabled ()) {
256- LOGGER .info ("transaction {} will be rollback, cause by:{}" , tx .getXid (),
257- originalException .getMessage ());
258- }
259251 tx .rollback ();
260252 triggerAfterRollback ();
261253 } catch (TransactionException txe ) {
0 commit comments