use of com.arjuna.webservices11.wsba.State in project narayana by jbosstm.
the class CoordinatorCompletionParticipantEngine method executeComplete.
/**
* Execute the complete transition.
*/
private void executeComplete() {
try {
participant.complete();
} catch (final Throwable th) {
WSTLogger.i18NLogger.warn_messaging_engines_CoordinatorCompletionParticipantEngine_executeComplete_1(th);
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev(th, "Unexpected exception from participant complete for WS-BA participant");
}
return;
}
State current;
boolean failRequired = false;
boolean deleteRequired = false;
boolean confirm = (participant instanceof ConfirmCompletedParticipant);
synchronized (this) {
current = state;
}
if (current == State.STATE_COMPLETING) {
// ok we need to write the participant details to disk because it has just completed
BAParticipantRecoveryRecord recoveryRecord = new BAParticipantRecoveryRecord(id, participant, false, coordinator);
if (!XTSBARecoveryManager.getRecoveryManager().writeParticipantRecoveryRecord(recoveryRecord)) {
// hmm, could not write entry log warning
WSTLogger.i18NLogger.warn_wst11_messaging_engines_CoordinatorCompletionParticipantEngine_executeComplete_2(id);
// we need to fail this transaction
failRequired = true;
}
}
synchronized (this) {
current = state;
if (current == State.STATE_COMPLETING) {
if (!failRequired) {
changeState(State.STATE_COMPLETED);
// record the fact that we have persisted this object so later operations will delete
// the log record
persisted = true;
// sent back and we cannot allow that until after the confirm
if (confirm) {
((ConfirmCompletedParticipant) participant).confirmCompleted(true);
}
} else {
// we must force a fail but we don't have a log record to delete
changeState(State.STATE_FAILING_COMPLETING);
}
} else {
// we cannot force a fail now so just delete
failRequired = false;
// we need to delete the log record here as the cancel would not have known it was persisted
deleteRequired = true;
}
}
if (failRequired) {
current = fail(BusinessActivityConstants.WSBA_ELEMENT_FAIL_QNAME);
// we can safely do this now
if (confirm) {
((ConfirmCompletedParticipant) participant).confirmCompleted(false);
}
} else if (deleteRequired) {
if (!XTSBARecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
// hmm, could not delete entry log warning
WSTLogger.i18NLogger.warn_wst11_messaging_engines_ParticipantCompletionParticipantEngine_completed_2(id);
}
if (confirm) {
((ConfirmCompletedParticipant) participant).confirmCompleted(false);
}
} else if (current == State.STATE_COMPLETING) {
sendCompleted();
}
}
use of com.arjuna.webservices11.wsba.State in project narayana by jbosstm.
the class CoordinatorCompletionParticipantEngine method failed.
/**
* Handle the failed event.
* @param failed The failed notification.
* @param map The addressing context.
* @param arjunaContext The arjuna context.
*
* Active -> Active (invalid state)
* Canceling -> Canceling (invalid state)
* Completing -> Completing (invalid state)
* Completed -> Completed (invalid state)
* Closing -> Closing (invalid state)
* Compensating -> Compensating (invalid state)
* Failing-Active -> Ended
* Failing-Canceling -> Ended
* Failing-Completing -> Ended
* Failing-Compensating -> Ended
* NotCompleting -> NotCompleting (invalid state)
* Exiting -> Exiting (invalid state)
* Ended -> Ended
*/
public void failed(final NotificationType failed, final MAP map, final ArjunaContext arjunaContext) {
final State current;
boolean deleteRequired = false;
synchronized (this) {
current = state;
if ((current == State.STATE_FAILING_ACTIVE) || (current == State.STATE_FAILING_CANCELING) || (current == State.STATE_FAILING_COMPLETING) || (current == State.STATE_FAILING_COMPENSATING)) {
deleteRequired = persisted;
}
}
if (deleteRequired) {
if (!XTSBARecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
// hmm, could not delete entry -- nothing more we can do than log a message
WSTLogger.i18NLogger.warn_wst11_messaging_engines_CoordinatorCompletionParticipantEngine_failed_1(id);
}
}
// now we have removed the log record we can safely get rid of the participant
if ((current == State.STATE_FAILING_ACTIVE) || (current == State.STATE_FAILING_CANCELING) || (current == State.STATE_FAILING_COMPLETING) || (current == State.STATE_FAILING_COMPENSATING)) {
ended();
}
}
use of com.arjuna.webservices11.wsba.State in project narayana by jbosstm.
the class CoordinatorCompletionCoordinatorProcessorImpl 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 CoordinatorCompletionCoordinatorInboundEvents 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_CoordinatorCompletionCoordinatorProcessorImpl_getStatus_4());
CoordinatorCompletionParticipantClient.getClient().sendSoapFault(soapFault, null, faultMAP, getFaultAction());
} catch (final Throwable th) {
WSTLogger.i18NLogger.info_wst11_messaging_CoordinatorCompletionCoordinatorProcessorImpl_getStatus_3(instanceIdentifier.toString(), th);
}
}
}
use of com.arjuna.webservices11.wsba.State in project narayana by jbosstm.
the class ParticipantCompletionParticipantProcessorImpl 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 ParticipantCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
if (participant != null) {
try {
participant.getStatus(getStatus, map, arjunaContext);
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception thrown from getStatus:", th);
}
}
} else {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("GetStatus called on unknown participant: {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_ParticipantCompletionParticipantProcessorImpl_getStatus_4());
ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(soapFault, null, faultMAP, getFaultAction());
} catch (final Throwable th) {
WSTLogger.i18NLogger.info_wst11_messaging_ParticipantCompletionParticipantProcessorImpl_getStatus_3(instanceIdentifier.toString(), th);
}
}
}
use of com.arjuna.webservices11.wsba.State in project narayana by jbosstm.
the class CoordinatorCompletionCoordinatorEngine method sendInvalidStateFault.
/**
* Send the invalid state fault message.
*/
private void sendInvalidStateFault() {
final MAP map = createContext();
try {
final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_engines_CoordinatorCompletionCoordinatorEngine_sendInvalidStateFault_2());
CoordinatorCompletionParticipantClient.getClient().sendSoapFault(soapFault, participant, map, getFaultAction());
} catch (final Throwable th) {
if (WSTLogger.logger.isTraceEnabled()) {
WSTLogger.logger.tracev("Unexpected exception while sending InvalidStateFault", th);
}
}
}
Aggregations