Search in sources :

Example 6 with SubordinateAtomicAction

use of com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction in project narayana by jbosstm.

the class SubordinateTxUnitTest method testAtomicAction.

@Test
public void testAtomicAction() throws Exception {
    SubordinateAtomicAction saa1 = new SubordinateAtomicAction();
    SubordinateAtomicAction saa2 = new SubordinateAtomicAction(new Uid());
    OutputObjectState os = new OutputObjectState();
    assertTrue(saa1.save_state(os, ObjectType.ANDPERSISTENT));
    InputObjectState is = new InputObjectState(os);
    assertTrue(saa2.restore_state(is, ObjectType.ANDPERSISTENT));
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) OutputObjectState(com.arjuna.ats.arjuna.state.OutputObjectState) SubordinateAtomicAction(com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction) Test(org.junit.Test)

Example 7 with SubordinateAtomicAction

use of com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction in project narayana by jbosstm.

the class InboundBridgeOrphanFilter method isInStore.

private boolean isInStore(Xid xid) {
    final RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
    final InputObjectState states = new InputObjectState();
    try {
        if (recoveryStore.allObjUids(SubordinateAtomicAction.getType(), states) && states.notempty()) {
            boolean finished = false;
            do {
                final Uid uid = UidHelper.unpackFrom(states);
                if (uid.notEquals(Uid.nullUid())) {
                    final SubordinateAtomicAction saa = new SubordinateAtomicAction(uid, true);
                    if (saa.getXid().equals(xid)) {
                        return true;
                    }
                } else {
                    finished = true;
                }
            } while (!finished);
        }
    } catch (ObjectStoreException e) {
        LOG.warn(e.getMessage(), e);
    } catch (IOException e) {
        LOG.warn(e.getMessage(), e);
    }
    return false;
}
Also used : InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) Uid(com.arjuna.ats.arjuna.common.Uid) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException) SubordinateAtomicAction(com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction) IOException(java.io.IOException) RecoveryStore(com.arjuna.ats.arjuna.objectstore.RecoveryStore)

Aggregations

SubordinateAtomicAction (com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction)7 Uid (com.arjuna.ats.arjuna.common.Uid)5 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)5 RecoveryStore (com.arjuna.ats.arjuna.objectstore.RecoveryStore)4 XidImple (com.arjuna.ats.jta.xa.XidImple)4 IOException (java.io.IOException)3 XAException (javax.transaction.xa.XAException)3 Xid (javax.transaction.xa.Xid)3 Test (org.junit.Test)3 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)2 XAResourceRecord (com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord)2 Stack (java.util.Stack)2 XAResource (javax.transaction.xa.XAResource)2 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)1 TransactionImple (com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.TransactionImple)1 UnexpectedConditionException (com.arjuna.ats.jta.exceptions.UnexpectedConditionException)1 HashSet (java.util.HashSet)1 HeuristicCommitException (javax.transaction.HeuristicCommitException)1 HeuristicMixedException (javax.transaction.HeuristicMixedException)1 HeuristicRollbackException (javax.transaction.HeuristicRollbackException)1