use of com.arjuna.wst.FaultedException in project narayana by jbosstm.
the class CoordinatorCompletionParticipantEngine method executeCompensate.
/**
* Execute the compensate transition.
*/
private void executeCompensate() {
try {
participant.compensate();
} catch (final FaultedException fe) {
WSTLogger.i18NLogger.warn_messaging_engines_CoordinatorCompletionParticipantEngine_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);
} 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_CoordinatorCompletionParticipantEngine_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();
}
}
use of com.arjuna.wst.FaultedException in project narayana by jbosstm.
the class BusinessActivityTerminatorStub method cancel.
public void cancel() throws FaultedException, UnknownTransactionException, SystemException {
final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
final RequestCallback callback = new RequestCallback();
final TerminationParticipantProcessor terminationParticipantProcessor = TerminationParticipantProcessor.getProcessor();
terminationParticipantProcessor.registerCallback(_id, callback);
try {
TerminationCoordinatorClient.getClient().sendCancel(_terminationCoordinator, map, new InstanceIdentifier(_id));
callback.waitUntilTriggered();
} catch (final Throwable th) {
throw new SystemException();
} finally {
terminationParticipantProcessor.removeCallback(_id);
}
if (callback.hasTriggered()) {
if (callback.receivedCancelled()) {
return;
} else if (callback.receivedFaulted()) {
throw new FaultedException();
}
final SoapFault soapFault = callback.getSoapFault();
if (soapFault != null) {
final QName subcode = soapFault.getSubcode();
if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode)) {
throw new UnknownTransactionException();
}
}
}
throw new SystemException();
}
use of com.arjuna.wst.FaultedException in project narayana by jbosstm.
the class BusinessActivityTerminatorStub method complete.
public void complete() throws FaultedException, UnknownTransactionException, SystemException {
final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
final RequestCallback callback = new RequestCallback();
final TerminationParticipantProcessor terminationParticipantProcessor = TerminationParticipantProcessor.getProcessor();
terminationParticipantProcessor.registerCallback(_id, callback);
try {
TerminationCoordinatorClient.getClient().sendComplete(_terminationCoordinator, map, new InstanceIdentifier(_id));
callback.waitUntilTriggered();
} catch (final Throwable th) {
throw new SystemException();
} finally {
terminationParticipantProcessor.removeCallback(_id);
}
if (callback.hasTriggered()) {
if (callback.receivedCompleted()) {
return;
} else if (callback.receivedFaulted()) {
throw new FaultedException();
}
final SoapFault soapFault = callback.getSoapFault();
if (soapFault != null) {
final QName subcode = soapFault.getSubcode();
if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode)) {
throw new UnknownTransactionException();
}
}
}
throw new SystemException();
}
Aggregations