Search in sources :

Example 1 with XTSATRecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.

the class BridgeWrapper method scan.

/**
 * return a list of bridge wrappers for all recovered subordinate transactions with a given
 * subordinate type
 * @param subordinateType the subordinate type supplied in the original bridge wrapper create call
 * which created the subordinate transaction.
 * @return a possibly zero-length array of bridge wrappers for all recovered subordinate AT transactions
 * with the given subordinate type or null if a subordinate coordinator recovery scan has not yet occurred
 */
public static BridgeWrapper[] scan(String subordinateType) {
    // return null if not yet ready
    XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
    if (!recoveryManager.isCoordinatorRecoveryStarted()) {
        return null;
    }
    if (subordinateType == null || subordinateType.equals(SUBORDINATE_TX_TYPE_AT_AT)) {
        return EMPTY_SCAN;
    }
    SubordinateATCoordinator[] coordinators = SubordinateATCoordinator.listRecoveredCoordinators();
    int count = 0;
    for (int i = 0; i < coordinators.length; i++) {
        if (coordinators[i].getSubordinateType().equals(subordinateType)) {
            count++;
        }
    }
    if (count == 0) {
        return EMPTY_SCAN;
    }
    BridgeWrapper[] result = new BridgeWrapper[count];
    count = 0;
    for (int i = 0; i < coordinators.length; i++) {
        SubordinateATCoordinator coordinator = coordinators[i];
        if (coordinator.getSubordinateType().equals(subordinateType)) {
            BridgeWrapper bridgeWrapper = new BridgeWrapper();
            bridgeWrapper.context = null;
            bridgeWrapper.coordinator = coordinator;
            bridgeWrapper.id = coordinator.get_uid().stringForm();
            bridgeWrapper.subordinateType = coordinator.getSubordinateType();
            result[count++] = bridgeWrapper;
        }
    }
    return result;
}
Also used : SubordinateATCoordinator(com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator) XTSATRecoveryManager(org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager)

Example 2 with XTSATRecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.

the class SubordinateDurable2PCStub method rollback.

/**
 * this will be called when the parent coordinator rolls back its durable participants and should ensure
 * that the interposed cooordinator does the same
 * @throws com.arjuna.wst.WrongStateException
 * @throws com.arjuna.wst.SystemException
 */
public void rollback() throws WrongStateException, SystemException {
    if (!isRecovered()) {
        coordinator.rollback();
    } else {
        // first check whether crashed coordinators have been recovered
        XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
        boolean isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
        // now look for a subordinate coordinator with the right id
        coordinator = SubordinateATCoordinator.getRecoveredCoordinator(coordinatorId);
        if (coordinator == null) {
            if (!isRecoveryScanStarted) {
                // throw an exception causing the rollback to be retried later
                throw new SystemException();
            }
        } else if (!coordinator.isActivated()) {
            // throw an exception causing the rollback to be retried later
            throw new SystemException();
        } else {
            int status = coordinator.status();
            if ((status == ActionStatus.ABORTED) || (status == ActionStatus.H_ROLLBACK) || (status == ActionStatus.ABORTING) || (status == ActionStatus.ABORT_ONLY)) {
                // ok, the rollback process was not previously initiated so start it now
                coordinator.rollback();
                SubordinateATCoordinator.removeActiveProxy(coordinatorId);
                status = coordinator.status();
            }
        }
    }
}
Also used : XTSATRecoveryManager(org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager)

Example 3 with XTSATRecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.

the class ATCoordinatorRecoveryModule method install.

/**
 * called by the service startup code before the recovery module is added to the recovery managers
 * module list
 */
public void install() {
    // installed in a single thread
    if (!XTSATRecoveryManagerImple.isRecoveryManagerInitialised()) {
        XTSATRecoveryManager atRecoveryManager = new XTSATRecoveryManagerImple(_recoveryStore);
        XTSATRecoveryManager.setRecoveryManager(atRecoveryManager);
    }
    Implementations.install();
}
Also used : XTSATRecoveryManager(org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager) XTSATRecoveryManagerImple(org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManagerImple)

Example 4 with XTSATRecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.

the class ParticipantProcessorImpl method rollback.

/**
 * Rollback.
 * @param rollback The rollback notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void rollback(final Notification rollback, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    /**
     * ensure the AT participant recovery manager is running
     */
    XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_rollback_3(instanceIdentifier.toString());
    }
    final ParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.rollback(rollback, map, arjunaContext);
        } catch (final Throwable th) {
            WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_rollback_1(th);
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_rollback_4(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_rollback_5(instanceIdentifier.toString());
    } else {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_rollback_2(instanceIdentifier.toString());
        sendAborted(map, arjunaContext);
    }
}
Also used : XTSATRecoveryManager(org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) ParticipantInboundEvents(com.arjuna.webservices11.wsat.ParticipantInboundEvents)

Example 5 with XTSATRecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager in project narayana by jbosstm.

the class ParticipantProcessorImpl method commit.

/**
 * Commit.
 * @param commit The commit notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void commit(final Notification commit, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    /**
     * ensure the AT participant recovery manager is running
     */
    XTSATRecoveryManager recoveryManager = XTSATRecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_commit_3(instanceIdentifier.toString());
        return;
    }
    final ParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.commit(commit, map, arjunaContext);
        } catch (final Throwable th) {
            WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_commit_1(th);
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_commit_4(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_commit_5(instanceIdentifier.toString());
    } else {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantProcessorImpl_commit_2(instanceIdentifier.toString());
        sendCommitted(map, arjunaContext);
    }
}
Also used : XTSATRecoveryManager(org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) ParticipantInboundEvents(com.arjuna.webservices11.wsat.ParticipantInboundEvents)

Aggregations

XTSATRecoveryManager (org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManager)7 SubordinateATCoordinator (com.arjuna.mwlabs.wscf.model.twophase.arjunacore.subordinate.SubordinateATCoordinator)2 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)2 ParticipantInboundEvents (com.arjuna.webservices11.wsat.ParticipantInboundEvents)2 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)1 XTSATRecoveryManagerImple (org.jboss.jbossts.xts.recovery.participant.at.XTSATRecoveryManagerImple)1