public boolean startTransaction ( ) { EmbeddedTransaction tx = new EmbeddedTransaction ( EmbeddedTransactionManager . getInstance ( ) ) ; tx . setXid ( xid ) ; LocalTransaction localTransaction = transactionTable . getOrCreateLocalTransaction ( tx , false , this :: newGlobalTransaction ) ; if ( createGlobalState ( localTransaction . getGlobalTransaction ( ) ) != Status . OK ) { //no need to rollback. nothing is enlisted in the transaction. transactionTable . removeLocalTransaction ( localTransaction ) ; return false ; } else { this . tx = tx ; this . localTxInvocationContext = new LocalTxInvocationContext ( localTransaction ) ; perCacheTxTable . createLocalTx ( xid , tx ) ; transactionTable . enlistClientTransaction ( tx , localTransaction ) ; return true ; } }
Starts a transaction .