Search in sources :

Example 1 with XTSBARecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.

the class ParticipantCompletionParticipantProcessorImpl method close.

/**
 * Close.
 * @param close The close notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void close(final NotificationType close, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    /**
     * ensure the BA participant recovery manager is running
     */
    XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_close_3(instanceIdentifier.toString());
        return;
    }
    final ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.close(close, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from close:", th);
            }
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_close_4(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_close_5(instanceIdentifier.toString());
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Close called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        sendClosed(map, arjunaContext);
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) ParticipantCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier)

Example 2 with XTSBARecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method cancel.

/**
 * Cancel.
 * @param cancel The cancel notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void cancel(final NotificationType cancel, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    /**
     * ensure the BA participant recovery manager is running
     */
    XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_cancel_3(instanceIdentifier.toString());
        return;
    }
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.cancel(cancel, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from cancel:", th);
            }
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_cancel_4(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_cancel_5(instanceIdentifier.toString());
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        sendCancelled(map, arjunaContext);
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Example 3 with XTSBARecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method complete.

/**
 * Complete.
 * @param complete The complete notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void complete(final NotificationType complete, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    /**
     * ensure the BA participant recovery manager is running
     */
    XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_complete_4(instanceIdentifier.toString());
        return;
    }
    if (participant != null) {
        try {
            participant.complete(complete, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from complete:", th);
            }
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_complete_5(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_complete_6(instanceIdentifier.toString());
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        sendFail(map, arjunaContext, State.STATE_ENDED.getValue());
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Example 4 with XTSBARecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.

the class SubordinateCoordinatorCompletionParticipantStub method cancel.

public void cancel() throws FaultedException, WrongStateException, SystemException {
    if (!recovered) {
        int result = coordinator.cancel();
        if (result != ActionStatus.ABORTED) {
            throw new FaultedException("failed to compensate subordinate transaction " + coordinatorId);
        }
    } else {
        XTSBARecoveryManager recoveryManager = null;
        boolean isRecoveryScanStarted = false;
        if (coordinator == null) {
            // try fetching coordinator from the recovery manager
            recoveryManager = XTSBARecoveryManager.getRecoveryManager();
            // check whether recovery has started before we check for the presence
            // of the subordinate coordinator
            isRecoveryScanStarted = recoveryManager.isSubordinateCoordinatorRecoveryStarted();
            coordinator = SubordinateBACoordinator.getRecoveredCoordinator(coordinatorId);
        }
        if (coordinator == null) {
            // hmm, still null -- see if we have finished recovery scanning
            if (!isRecoveryScanStarted) {
                // throw an exception causing the commit to be retried later
                throw new SystemException();
            }
        // ok we have no transaction to commit so assume we already committed it and
        // return without error
        } else if (!coordinator.isActivated()) {
            // throw an exception causing the commit to be retried later
            throw new SystemException();
        } else {
            int status = coordinator.status();
            if (status == ActionStatus.PREPARED || status == ActionStatus.COMMITTING) {
                // ok, the commit process was not previously initiated so start it now
                coordinator.cancel();
                SubordinateBACoordinator.removeActiveProxy(coordinatorId);
            }
            if (status == ActionStatus.COMMITTING) {
                // throw an exception causing the commit to be retried later
                throw new SystemException();
            } else if (status != ActionStatus.ABORTED) {
                throw new FaultedException();
            }
        }
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) SystemException(com.arjuna.wst.SystemException)

Example 5 with XTSBARecoveryManager

use of org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method close.

/**
 * Close.
 * @param close The close notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void close(final NotificationType close, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    /**
     * ensure the BA participant recovery manager is running
     */
    XTSBARecoveryManager recoveryManager = XTSBARecoveryManager.getRecoveryManager();
    if (recoveryManager == null) {
        // log warning and drop this message -- it will be resent
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_close_3(instanceIdentifier.toString());
        return;
    }
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.close(close, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from close:", th);
            }
        }
    } else if (!recoveryManager.isParticipantRecoveryStarted()) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_close_4(instanceIdentifier.toString());
    } else if (recoveryManager.findParticipantRecoveryRecord(instanceIdentifier.getInstanceIdentifier()) != null) {
        WSTLogger.i18NLogger.warn_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_close_5(instanceIdentifier.toString());
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("Close called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        sendClosed(map, arjunaContext);
    }
}
Also used : XTSBARecoveryManager(org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Aggregations

XTSBARecoveryManager (org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManager)11 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)7 CoordinatorCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)4 ParticipantCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents)3 SystemException (com.arjuna.wst.SystemException)3 XTSBARecoveryManagerImple (org.jboss.jbossts.xts.recovery.participant.ba.XTSBARecoveryManagerImple)1