Search in sources :

Example 6 with HeuristicCommitException

use of javax.transaction.HeuristicCommitException in project narayana by jbosstm.

the class TransactionImple method doRollback.

public void doRollback() throws IllegalStateException, HeuristicMixedException, HeuristicCommitException, HeuristicRollbackException, SystemException {
    try {
        SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction;
        if (!endSuspendedRMs()) {
            jtaLogger.i18NLogger.warn_transaction_arjunacore_endsuspendfailed1();
        }
        // JBTM-927 the transaction reaper may have aborted this transaction already
        int res = subAct.status() == ActionStatus.ABORTED ? ActionStatus.ABORTED : subAct.doRollback();
        switch(res) {
            case ActionStatus.ABORTED:
            case ActionStatus.ABORTING:
                TransactionImple.removeTransaction(this);
                break;
            case ActionStatus.H_ROLLBACK:
                throw new HeuristicRollbackException();
            case ActionStatus.H_COMMIT:
                throw new HeuristicCommitException();
            case ActionStatus.H_HAZARD:
            case ActionStatus.H_MIXED:
                throw new HeuristicMixedException();
            default:
                throw new HeuristicMixedException();
        }
    } catch (ClassCastException ex) {
        ex.printStackTrace();
        UnexpectedConditionException unexpectedConditionException = new UnexpectedConditionException(ex.toString());
        unexpectedConditionException.initCause(ex);
        throw unexpectedConditionException;
    }
}
Also used : HeuristicRollbackException(javax.transaction.HeuristicRollbackException) UnexpectedConditionException(com.arjuna.ats.jta.exceptions.UnexpectedConditionException) HeuristicMixedException(javax.transaction.HeuristicMixedException) HeuristicCommitException(javax.transaction.HeuristicCommitException)

Aggregations

HeuristicCommitException (javax.transaction.HeuristicCommitException)6 HeuristicMixedException (javax.transaction.HeuristicMixedException)6 HeuristicRollbackException (javax.transaction.HeuristicRollbackException)6 UnexpectedConditionException (com.arjuna.ats.jta.exceptions.UnexpectedConditionException)4 SystemException (javax.transaction.SystemException)3 XAException (javax.transaction.xa.XAException)3 SubordinateTransaction (com.arjuna.ats.internal.jta.transaction.arjunacore.jca.SubordinateTransaction)1 IOException (java.io.IOException)1 RollbackException (javax.transaction.RollbackException)1