private void enlistTransaction ( ) { this . cleanupTransactionBinding ( ) ; TransactionBindingType transactionBindingType = this . transactionBinding . getTransactionBindingType ( ) ; // not associated to global transaction, try to associate a global // transaction if ( this . isInGlobalTransaction ( ) && transactionBindingType != TransactionBindingType . GlobalTransaction ) { try { Transaction ntx = this . transactionManager . getTransaction ( ) ; // Bitronix calls start on reaction of enlist --- check if cycle if ( ! enlisted && ntx != null ) { this . enlisted = true ; // enlisted makes startTransaactionalBranch calling this . enlisted = ntx . enlistResource ( this . xaResource ) ; if ( ! enlisted ) { LOG . error ( "Enlisting " + xaResource + " failed" ) ; } else { } } else { LOG . debug ( "SampleXAConnection:connectionRequiresTransaction (no globalTransaction found)" ) ; } } catch ( RollbackException n ) { LOG . error ( "SampleXAConnection:prevokeAction enlistResource exception : " + n . toString ( ) ) ; } catch ( SystemException n ) { LOG . error ( "SampleXAConnection:connectionRequiresTransaction " + n + "\n" + ExceptionUtils . getStackTrace ( n ) ) ; throw new DelegatedRuntimeException ( n ) ; } } else if ( transactionBindingType == TransactionBindingType . NoTransaction ) { this . transactionBinding . activateLocalTransaction ( new LocalTransactionProxy < C > ( this . managedConnectionFactory . getManagedConnection ( ) ) ) ; } else { // In Global Transaction and associated to a global transaction // => nothing to do if ( this . isInGlobalTransaction ( ) && transactionBindingType == TransactionBindingType . GlobalTransaction ) { // Not in Global Transaction and associated to a local // transaction => nothing to do } else if ( ! this . isInGlobalTransaction ( ) && transactionBindingType == TransactionBindingType . LocalTransaction ) { } } }
if necessary the current xa resource is enlisted in the current TX .