public void commitOnePhase ( ) throws XAException { if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "commitOnePhase" , _txn ) ; final int state = _txn . getTransactionState ( ) . getState ( ) ; switch ( state ) { case TransactionState . STATE_ACTIVE : // Suspend local transaction if present suspend ( ) ; try { // Resume imported transaction _tranManager . resume ( _txn ) ; _txn . prolongFinish ( ) ; _txn . commit_one_phase ( ) ; _txn . notifyCompletion ( ) ; } catch ( RollbackException e ) { _txn . notifyCompletion ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commitOnePhase" , "commit threw RollbackException" ) ; throw new XAException ( XAException . XA_RBROLLBACK ) ; } catch ( HeuristicMixedException e ) { _heuristic = StatefulResource . HEURISTIC_MIXED ; } catch ( HeuristicHazardException e ) { _heuristic = StatefulResource . HEURISTIC_HAZARD ; } catch ( HeuristicRollbackException e ) { _heuristic = StatefulResource . HEURISTIC_ROLLBACK ; } catch ( IllegalStateException e ) { _txn . notifyCompletion ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commitOnePhase" , "commit threw IllegalStateException" ) ; throw new XAException ( XAException . XAER_PROTO ) ; } catch ( InvalidTransactionException e ) // tm.resume { if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commitOnePhase" , "commit threw InvalidTransactionException" ) ; throw new XAException ( XAException . XAER_RMERR ) ; } catch ( SystemException e ) { _txn . notifyCompletion ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commitOnePhase" , "commit threw SystemException" ) ; throw new XAException ( XAException . XAER_RMERR ) ; } finally { // Resume local transaction if we suspended it earlier resume ( ) ; } break ; case TransactionState . STATE_COMMITTING : case TransactionState . STATE_COMMITTED : // probably a retry, just accept break ; case TransactionState . STATE_ROLLING_BACK : case TransactionState . STATE_ROLLED_BACK : case TransactionState . STATE_HEURISTIC_ON_ROLLBACK : _heuristic = StatefulResource . HEURISTIC_ROLLBACK ; break ; case TransactionState . STATE_HEURISTIC_ON_COMMIT : _heuristic = StatefulResource . HEURISTIC_COMMIT ; break ; case TransactionState . STATE_NONE : // transaction has completed and is now finished break ; default : if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commitOnePhase" , "transaction is in an incorrect state" ) ; throw new XAException ( XAException . XAER_PROTO ) ; } recordHeuristicOnCommitOnePhase ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "commitOnePhase" ) ; }
Informs the object that the transaction is to be committed in one - phase