Search in sources :

Example 26 with RecoveryStore

use of com.arjuna.ats.arjuna.objectstore.RecoveryStore in project narayana by jbosstm.

the class JCAServerTransactionRecoveryModule method periodicWorkFirstPass.

@Override
public void periodicWorkFirstPass() {
    try {
        RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
        InputObjectState states = new InputObjectState();
        if (recoveryStore.allObjUids(ServerTransaction.getType(), states) && (states.notempty())) {
            boolean finished = false;
            do {
                Uid uid = UidHelper.unpackFrom(states);
                if (uid.notEquals(Uid.nullUid())) {
                    SubordinationManager.getTransactionImporter().recoverTransaction(uid);
                } else {
                    finished = true;
                }
            } while (!finished);
        }
    } catch (ObjectStoreException | XAException | IOException e) {
        e.printStackTrace();
    }
}
Also used : InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) Uid(com.arjuna.ats.arjuna.common.Uid) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException) XAException(javax.transaction.xa.XAException) IOException(java.io.IOException) RecoveryStore(com.arjuna.ats.arjuna.objectstore.RecoveryStore)

Example 27 with RecoveryStore

use of com.arjuna.ats.arjuna.objectstore.RecoveryStore in project narayana by jbosstm.

the class Coordinator method getUids.

// Look up all log records for a given type
private static Set<Uid> getUids(Set<Uid> uids, String type) {
    try {
        RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
        InputObjectState states = new InputObjectState();
        if (recoveryStore.allObjUids(type, states) && states.notempty()) {
            boolean finished = false;
            do {
                Uid uid = UidHelper.unpackFrom(states);
                if (uid.notEquals(Uid.nullUid())) {
                    uids.add(uid);
                } else {
                    finished = true;
                }
            } while (!finished);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return uids;
}
Also used : InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) Uid(com.arjuna.ats.arjuna.common.Uid) RecoveryStore(com.arjuna.ats.arjuna.objectstore.RecoveryStore) TransactionStatusException(org.jboss.jbossts.star.provider.TransactionStatusException) ResourceNotFoundException(org.jboss.jbossts.star.provider.ResourceNotFoundException)

Example 28 with RecoveryStore

use of com.arjuna.ats.arjuna.objectstore.RecoveryStore 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)

Example 29 with RecoveryStore

use of com.arjuna.ats.arjuna.objectstore.RecoveryStore in project narayana by jbosstm.

the class RecoveryManager method removeParticipantInformation.

public void removeParticipantInformation(final ParticipantInformation participantInformation) {
    if (LOG.isTraceEnabled()) {
        LOG.trace("RecoveryManager.removeParticipantInformation: participantInformation=" + participantInformation);
    }
    final RecoveryStore recoveryStore = StoreManager.getRecoveryStore();
    final Uid uid = new Uid(participantInformation.getId());
    try {
        recoveryStore.remove_committed(uid, PARTICIPANT_INFORMATION_RECORD_TYPE);
    } catch (ObjectStoreException e) {
        LOG.warn("Failure while removing participant information from the object store.", e);
    }
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) ObjectStoreException(com.arjuna.ats.arjuna.exceptions.ObjectStoreException) RecoveryStore(com.arjuna.ats.arjuna.objectstore.RecoveryStore)

Aggregations

RecoveryStore (com.arjuna.ats.arjuna.objectstore.RecoveryStore)29 Uid (com.arjuna.ats.arjuna.common.Uid)27 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)23 IOException (java.io.IOException)10 ObjectStoreException (com.arjuna.ats.arjuna.exceptions.ObjectStoreException)9 OutputObjectState (com.arjuna.ats.arjuna.state.OutputObjectState)8 Test (org.junit.Test)7 XAException (javax.transaction.xa.XAException)5 SubordinateAtomicAction (com.arjuna.ats.internal.jta.transaction.arjunacore.subordinate.jca.SubordinateAtomicAction)4 XidImple (com.arjuna.ats.jta.xa.XidImple)3 Stack (java.util.Stack)3 AtomicAction (com.arjuna.ats.arjuna.AtomicAction)2 LogStore (com.arjuna.ats.internal.arjuna.objectstore.LogStore)2 UnexpectedConditionException (com.arjuna.ats.jta.exceptions.UnexpectedConditionException)2 UnknownHostException (java.net.UnknownHostException)2 HashSet (java.util.HashSet)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 HeuristicCommitException (javax.transaction.HeuristicCommitException)2 HeuristicMixedException (javax.transaction.HeuristicMixedException)2