public int prepare ( boolean onePhaseCommit ) { Status status = loggingPreparing ( ) ; if ( status != Status . OK ) { //error, marked_*, no_transaction code (other node changed the state). we simply reply with rollback return XAException . XA_RBROLLBACK ; } boolean prepared = tx . runPrepare ( ) ; if ( prepared ) { if ( onePhaseCommit ) { return onePhaseCommitTransaction ( ) ; } else { status = loggingPrepared ( ) ; return status == Status . OK ? XAResource . XA_OK : XAException . XA_RBROLLBACK ; } } else { //Infinispan automatically rollbacks the transaction //we try to update the state and we don't care about the response. loggingCompleted ( false ) ; perCacheTxTable . removeLocalTx ( xid ) ; return XAException . XA_RBROLLBACK ; } }
Prepares the transaction .