Search in sources :

Example 11 with DemoDurableParticipant

use of com.arjuna.wstx.tests.common.DemoDurableParticipant in project narayana by jbosstm.

the class RollbackExceptionInRollbackTest method testRollbackExceptionInRollback.

@Test
public void testRollbackExceptionInRollback() throws Exception {
    UserTransaction ut = UserTransaction.getUserTransaction();
    TransactionManager tm = TransactionManager.getTransactionManager();
    FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_ROLLBACK, FailureParticipant.WRONG_STATE);
    DemoDurableParticipant p2 = new DemoDurableParticipant();
    ut.begin();
    try {
        tm.enlistForDurableTwoPhase(p1, "failure");
        tm.enlistForDurableTwoPhase(p2, p2.identifier());
    } catch (Exception eouter) {
        try {
            ut.rollback();
        } catch (Exception einner) {
        }
        throw eouter;
    }
    ut.rollback();
}
Also used : UserTransaction(com.arjuna.mw.wst11.UserTransaction) FailureParticipant(com.arjuna.wstx.tests.common.FailureParticipant) TransactionManager(com.arjuna.mw.wst11.TransactionManager) DemoDurableParticipant(com.arjuna.wstx.tests.common.DemoDurableParticipant) Test(org.junit.Test)

Aggregations

TransactionManager (com.arjuna.mw.wst11.TransactionManager)11 UserTransaction (com.arjuna.mw.wst11.UserTransaction)11 DemoDurableParticipant (com.arjuna.wstx.tests.common.DemoDurableParticipant)11 Test (org.junit.Test)11 TxContext (com.arjuna.mw.wst.TxContext)6 FailureParticipant (com.arjuna.wstx.tests.common.FailureParticipant)5 DemoVolatileParticipant (com.arjuna.wstx.tests.common.DemoVolatileParticipant)4 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)2