Search in sources :

Example 6 with FaultedException

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();
    }
}
Also used : State(com.arjuna.webservices11.wsba.State) FaultedException(com.arjuna.wst.FaultedException)

Example 7 with FaultedException

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();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) FaultedException(com.arjuna.wst.FaultedException) MAP(org.jboss.ws.api.addressing.MAP) TerminationParticipantProcessor(com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor)

Example 8 with FaultedException

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();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) FaultedException(com.arjuna.wst.FaultedException) MAP(org.jboss.ws.api.addressing.MAP) TerminationParticipantProcessor(com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor)

Aggregations

FaultedException (com.arjuna.wst.FaultedException)8 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)6 SystemException (com.arjuna.wst.SystemException)6 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)6 SoapFault (com.arjuna.webservices.SoapFault)4 BusinessActivityTerminator (com.arjuna.wst11.BusinessActivityTerminator)4 MAP (org.jboss.ws.api.addressing.MAP)4 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)3 SoapFault11 (com.arjuna.webservices11.SoapFault11)2 TerminationParticipantProcessor (com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor)2 State (com.arjuna.webservices11.wsba.State)2 QName (javax.xml.namespace.QName)2 SOAPException (javax.xml.soap.SOAPException)2 SOAPFactory (javax.xml.soap.SOAPFactory)2 SOAPFault (javax.xml.soap.SOAPFault)2 ProtocolException (javax.xml.ws.ProtocolException)2 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2