use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class CoordinatorCompletionCoordinatorEngine method close.
/**
* Handle the close event.
* @return The state.
*
* Active -> Active (invalid state)
* Canceling-Active -> Canceling-Active (invalid state)
* Canceling-Completing -> Canceling-Completing (invalid state)
* Completing -> Completing (invalid state)
* Completed -> Closing
* Closing -> Closing
* Compensating -> Compensating (invalid state)
* Failing-Active -> Failing-Active (invalid state)
* Failing-Canceling -> Failing-Canceling (invalid state)
* Failing-Completing -> Failing-Completing (invalid state)
* Failing-Compensating -> Failing-Compensating (invalid state)
* NotCompleting -> NotCompleting (invalid state)
* Exiting -> Exiting (invalid state)
* Ended -> Ended (invalid state)
*/
public State close() {
State current;
synchronized (this) {
current = state;
if (current == State.STATE_COMPLETED) {
changeState(State.STATE_CLOSING);
}
}
if (current == State.STATE_COMPLETED) {
sendClose();
waitForState(State.STATE_CLOSING, TransportTimer.getTransportTimeout());
}
synchronized (this) {
if (state != State.STATE_CLOSING) {
if (recovered) {
CoordinatorCompletionCoordinatorProcessor.getProcessor().deactivateCoordinator(this);
}
if (state == State.STATE_ENDED && failureState != null) {
return failureState;
}
return state;
} else {
// timeout -- leave participant in place as this TX will get retried later
return State.STATE_CLOSING;
}
}
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class CoordinatorCompletionCoordinatorEngine method getStatus.
/**
* Handle the getStatus event.
* @param getStatus The getStatus notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void getStatus(final NotificationType getStatus, final MAP map, final ArjunaContext arjunaContext) {
final State current;
synchronized (this) {
current = state;
}
sendStatus(current);
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class CoordinatorCompletionCoordinatorEngine method complete.
/**
* Handle the complete event.
* @return The state.
*
* Active -> Completing
* Canceling-Active -> Canceling-Active (invalid state)
* Canceling-Completing -> Canceling-Completing (invalid state)
* Completing -> Completing
* Completed -> Completed (invalid state)
* Closing -> Closing (invalid state)
* Compensating -> Compensating (invalid state)
* Failing-Active -> Failing-Active (invalid state)
* Failing-Canceling -> Failing-Canceling (invalid state)
* Failing-Completing -> Failing-Completing (invalid state)
* Failing-Compensating -> Failing-Compensating (invalid state)
* NotCompleting -> NotCompleting (invalid state)
* Exiting -> Exiting (invalid state)
* Ended -> Ended (invalid state)
*/
public State complete() {
final State current;
synchronized (this) {
current = state;
if (current == State.STATE_ACTIVE) {
changeState(State.STATE_COMPLETING);
}
}
if (current == State.STATE_ACTIVE) {
sendComplete();
waitForState(State.STATE_COMPLETING, TransportTimer.getTransportTimeout());
}
synchronized (this) {
if (state == State.STATE_ENDED && failureState != null) {
return failureState;
}
return state;
}
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class ParticipantCompletionCoordinatorProcessorImpl method getStatus.
/**
* Get Status.
* @param getStatus The get status notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*/
public void getStatus(final NotificationType getStatus, final MAP map, final ArjunaContext arjunaContext) {
final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
final ParticipantCompletionCoordinatorInboundEvents coordinator = getCoordinator(instanceIdentifier);
if (coordinator != null) {
try {
coordinator.getStatus(getStatus, map, arjunaContext);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from getStatus:", th);
}
}
} else if (!areRecoveryLogEntriesAccountedFor()) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("GetStatus dropped for unknown coordinator completion participant {0} while waiting on recovery scan", new Object[] { instanceIdentifier });
}
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("GetStatus called on unknown coordinator: {0}", new Object[] { instanceIdentifier });
}
// send an invalid state fault
final String messageId = MessageId.getMessageId();
final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
try {
final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_ParticipantCompletionCoordinatorProcessorImpl_getStatus_4());
AddressingHelper.installNoneReplyTo(faultMAP);
ParticipantCompletionParticipantClient.getClient().sendSoapFault(soapFault, null, faultMAP, getFaultAction());
} catch (final Throwable th) {
WSTLogger.i18NLogger.info_wst11_messaging_ParticipantCompletionCoordinatorProcessorImpl_getStatus_3(instanceIdentifier.toString(), th);
}
}
}
use of com.arjuna.webservices11.wsat.State in project narayana by jbosstm.
the class ParticipantCompletionParticipantEngine method executeCompensate.
/**
* Execute the compensate transition.
*/
private void executeCompensate() {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.trace(getClass().getSimpleName() + ".executeCompensate. Participant: " + participant);
}
try {
participant.compensate();
} catch (final FaultedException fe) {
WSTLogger.i18NLogger.warn_messaging_engines_ParticipantCompletionParticipantEngine_executeCompensate_1(fe);
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev(fe, "Faulted exception from participant compensate for WS-BA participant");
}
// fail here because the participant doesn't want to retry the compensate
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
return;
} catch (final Throwable th) {
final State current;
synchronized (this) {
current = state;
if (current == State.STATE_COMPENSATING) {
changeState(State.STATE_COMPLETED);
}
}
if (current == State.STATE_COMPENSATING) {
initiateTimer();
}
WSTLogger.i18NLogger.warn_messaging_engines_ParticipantCompletionParticipantEngine_executeCompensate_2(th);
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev(th, "Unexpected exception from participant compensate for WS-BA participant");
}
return;
}
final State current;
boolean failRequired = false;
synchronized (this) {
current = state;
if (current == State.STATE_COMPENSATING) {
if (persisted) {
if (!XTSBARecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
// we have to fail since we don't want to run the compensate method again
WSTLogger.i18NLogger.warn_wst11_messaging_engines_ParticipantCompletionParticipantEngine_executeCompensate_3(id);
failRequired = true;
changeState(State.STATE_FAILING_COMPENSATING);
}
}
// we will send the compensate after we exit the synchronized block
if (!failRequired) {
ended();
}
}
}
if (failRequired) {
fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
} else if (current == State.STATE_COMPENSATING) {
sendCompensated();
}
}
Aggregations