Search in sources :

Example 1 with BusinessAgreementWithCoordinatorCompletionParticipant

use of com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant in project narayana by jbosstm.

the class BAParticipantRecoveryRecord method activate.

/**
 * create a participant engine to manage commit or rollback processing for the
 * participant and install it in the active participants table
 */
public void activate() {
    if (isParticipantCompletion) {
        ParticipantCompletionParticipantEngine engine = new ParticipantCompletionParticipantEngine(id, endpoint, participant, State.STATE_COMPLETED, true);
        ParticipantCompletionParticipantProcessor.getProcessor().activateParticipant(engine, getId());
        engine.recovery();
    } else {
        BusinessAgreementWithCoordinatorCompletionParticipant coordinatorCompletionParticipant = (BusinessAgreementWithCoordinatorCompletionParticipant) participant;
        CoordinatorCompletionParticipantEngine engine = new CoordinatorCompletionParticipantEngine(id, endpoint, coordinatorCompletionParticipant, State.STATE_COMPLETED, true);
        CoordinatorCompletionParticipantProcessor.getProcessor().activateParticipant(engine, getId());
        engine.recovery();
    }
}
Also used : BusinessAgreementWithCoordinatorCompletionParticipant(com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant) ParticipantCompletionParticipantEngine(com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine) CoordinatorCompletionParticipantEngine(com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine)

Example 2 with BusinessAgreementWithCoordinatorCompletionParticipant

use of com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant in project narayana by jbosstm.

the class XTSBASubordinateRecoveryModule method recreateCoordinatorCompletionParticipant.

public BusinessAgreementWithCoordinatorCompletionParticipant recreateCoordinatorCompletionParticipant(String id, byte[] recoveryState) throws Exception {
    if (id.startsWith(SubordinateBACoordinator.PARTICIPANT_PREFIX)) {
        if (!id.endsWith("_CCP")) {
            // throw an exception because we don't expect participant completion participants at present
            throw new Exception("XTSBASubordinateRecoveryModule : invalid name for subordinate WS-BA coordinator coordinator completion participant participant " + id);
        }
        // ok, try to recreate the participant
        InputObjectState ios = new InputObjectState();
        ios.setBuffer(recoveryState);
        String className = ios.unpackString();
        Class participantClass = this.getClass().getClassLoader().loadClass(className);
        BusinessAgreementWithCoordinatorCompletionParticipant participant = (BusinessAgreementWithCoordinatorCompletionParticipant) participantClass.newInstance();
        ((PersistableParticipant) participant).restoreState(ios);
        return participant;
    }
    return null;
}
Also used : BusinessAgreementWithCoordinatorCompletionParticipant(com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant) InputObjectState(com.arjuna.ats.arjuna.state.InputObjectState) PersistableParticipant(com.arjuna.wst.PersistableParticipant)

Example 3 with BusinessAgreementWithCoordinatorCompletionParticipant

use of com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant in project narayana by jbosstm.

the class TestBARecoveryModule method deserializeCoordinatorCompletionParticipant.

public BusinessAgreementWithCoordinatorCompletionParticipant deserializeCoordinatorCompletionParticipant(String id, ObjectInputStream stream) throws Exception {
    if (id.startsWith(Constants.PARTICIPANT_ID_PREFIX + "CoordinatorCompletionParticipant")) {
        System.out.println("xts service test : attempting to deserialize WS-BA coordinator completion participant " + id);
        BusinessAgreementWithCoordinatorCompletionParticipant participant = (BusinessAgreementWithCoordinatorCompletionParticipant) stream.readObject();
        System.out.println("xts service test : deserialized WS-BA coordinator completion participant " + id);
        return participant;
    }
    return null;
}
Also used : BusinessAgreementWithCoordinatorCompletionParticipant(com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant)

Aggregations

BusinessAgreementWithCoordinatorCompletionParticipant (com.arjuna.wst.BusinessAgreementWithCoordinatorCompletionParticipant)3 InputObjectState (com.arjuna.ats.arjuna.state.InputObjectState)1 PersistableParticipant (com.arjuna.wst.PersistableParticipant)1 CoordinatorCompletionParticipantEngine (com.arjuna.wst11.messaging.engines.CoordinatorCompletionParticipantEngine)1 ParticipantCompletionParticipantEngine (com.arjuna.wst11.messaging.engines.ParticipantCompletionParticipantEngine)1