use of com.arjuna.ats.jta.exceptions.UnexpectedConditionException 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;
}
}
use of com.arjuna.ats.jta.exceptions.UnexpectedConditionException in project narayana by jbosstm.
the class TransactionImple method doOnePhaseCommit.
public void doOnePhaseCommit() throws IllegalStateException, javax.transaction.HeuristicMixedException, javax.transaction.SystemException, RollbackException {
try {
SubordinateAtomicAction subAct = (SubordinateAtomicAction) super._theTransaction;
if (!endSuspendedRMs())
_theTransaction.preventCommit();
int status = subAct.doOnePhaseCommit();
switch(status) {
case ActionStatus.COMMITTED:
case ActionStatus.COMMITTING:
case ActionStatus.H_COMMIT:
TransactionImple.removeTransaction(this);
break;
case ActionStatus.ABORTED:
case ActionStatus.ABORTING:
case ActionStatus.H_ROLLBACK:
TransactionImple.removeTransaction(this);
// in which case IllegalState may be a better option?
throw new RollbackException();
case ActionStatus.INVALID:
throw new InvalidTerminationStateException();
case ActionStatus.H_HAZARD:
case ActionStatus.H_MIXED:
default:
throw new javax.transaction.HeuristicMixedException();
}
} catch (ClassCastException ex) {
ex.printStackTrace();
UnexpectedConditionException unexpectedConditionException = new UnexpectedConditionException(ex.toString());
unexpectedConditionException.initCause(ex);
throw unexpectedConditionException;
}
}
Aggregations