Search in sources :

Example 11 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException in project narayana by jbosstm.

the class UserTransactionStandaloneImple method begin.

public void begin(int timeout) throws WrongStateException, SystemException {
    try {
        if (_ctxManager.currentTransaction() != null)
            throw new WrongStateException();
        Context ctx = startTransaction(timeout, null);
        _ctxManager.resume(new TxContextImple(ctx));
        enlistCompletionParticipants();
    } catch (InvalidCreateParametersException ex) {
        tidyup();
        throw new SystemException(ex.toString());
    } catch (UnknownTransactionException ex) {
        tidyup();
        throw new SystemException(ex.toString());
    } catch (SystemException ex) {
        tidyup();
        throw ex;
    }
}
Also used : Context(com.arjuna.mw.wsc11.context.Context) CoordinationContext(org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException)

Example 12 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException in project narayana by jbosstm.

the class BridgeXAResource method readObject.

/**
 * Deserialization hook. Unpacks transaction recovery information and uses it to
 * recover the subordinate transaction.
 *
 * @param in the stream from which to unpack the object state.
 * @throws IOException if deserialzation and recovery fail.
 * @throws ClassNotFoundException if deserialzation fails.
 */
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
    txbridgeLogger.logger.trace("BridgeXAResource.readObject()");
    // in.defaultReadObject();
    externalTxId = (Uid) in.readObject();
    bridgeWrapperId = (String) in.readObject();
    // this readObject method executes only when a log is being read at recovery time:
    isAwaitingRecovery = true;
    synchronized (xaResourcesAwaitingRecovery) {
        xaResourcesAwaitingRecovery.add(this);
    }
    try {
        bridgeWrapper = BridgeWrapper.recover(bridgeWrapperId);
    // rollback and commit will deal with bridgeWrapper == null cases via ensureRecoveryIsDoneIfNeeded
    } catch (UnknownTransactionException unknownTransactionException) {
        txbridgeLogger.i18NLogger.error_obxar_unabletorecover(bridgeWrapperId, unknownTransactionException);
        throw new IOException(unknownTransactionException);
    }
}
Also used : UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) IOException(java.io.IOException)

Example 13 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException in project narayana by jbosstm.

the class TestATServiceImpl method doNothing.

@WebMethod
public void doNothing() {
    try {
        TransactionManager transactionManager = TransactionManagerFactory.transactionManager();
        transactionManager.enlistForDurableTwoPhase(new TestATServiceParticipant(), "testServiceAT:" + UUID.randomUUID());
    } catch (UnknownTransactionException e) {
    // Ignore if no transaction
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionManager(com.arjuna.mw.wst11.TransactionManager) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WebMethod(javax.jws.WebMethod)

Example 14 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException in project narayana by jbosstm.

the class TerminationCoordinatorProcessorImpl 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();
    final BusinessActivityTerminator participant = getParticipant(instanceIdentifier);
    try {
        if (participant != null) {
            W3CEndpointReference endpoint = participant.getEndpoint();
            final String messageId = MessageId.getMessageId();
            try {
                participant.cancel();
            } catch (final FaultedException fe) {
                final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
                TerminationParticipantClient.getClient().sendFaulted(endpoint, responseMAP, instanceIdentifier);
            } catch (final UnknownTransactionException ute) {
                final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_1());
                TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
                return;
            } catch (final SystemException se) {
                final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
                final String message = WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_2();
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
                TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
                return;
            } catch (final Throwable th) {
                if (WSTLogger.logger.isTraceEnabled()) {
                    WSTLogger.logger.tracev("Unexpected exception thrown from cancel:", th);
                }
                final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
                final SoapFault soapFault = new SoapFault11(th);
                TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
                return;
            }
            final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
            TerminationParticipantClient.getClient().sendCancelled(endpoint, responseMAP, instanceIdentifier);
        } else {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Cancel called on unknown participant: {0}", new Object[] { instanceIdentifier });
            }
            final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
            final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_5());
            TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultMAP, instanceIdentifier);
        }
    } catch (Throwable throwable) {
        throwable.printStackTrace(System.err);
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) BusinessActivityTerminator(com.arjuna.wst11.BusinessActivityTerminator) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) FaultedException(com.arjuna.wst.FaultedException) MAP(org.jboss.ws.api.addressing.MAP)

Example 15 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException in project narayana by jbosstm.

the class TerminationCoordinatorProcessorImpl 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 BusinessActivityTerminator participant = getParticipant(instanceIdentifier);
    try {
        if (participant != null) {
            W3CEndpointReference endpoint = participant.getEndpoint();
            final String messageId = MessageId.getMessageId();
            try {
                participant.complete();
            } catch (final FaultedException fe) {
                final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
                TerminationParticipantClient.getClient().sendFaulted(endpoint, responseMAP, instanceIdentifier);
            } catch (final UnknownTransactionException ute) {
                final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_12());
                TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
                return;
            } catch (final SystemException se) {
                final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
                final String message = WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_13();
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message);
                TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
                return;
            } catch (final Throwable th) {
                if (WSTLogger.logger.isTraceEnabled()) {
                    WSTLogger.logger.tracev("Unexpected exception thrown from complete:", th);
                }
                final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
                final SoapFault soapFault = new SoapFault11(th);
                TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultMAP, soapFault, instanceIdentifier);
                return;
            }
            final MAP responseMAP = AddressingHelper.createNotificationContext(messageId);
            TerminationParticipantClient.getClient().sendCompleted(endpoint, responseMAP, instanceIdentifier);
        } else {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Complete called on unknown participant: {0}", new Object[] { instanceIdentifier });
            }
            final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
            final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_TerminationCoordinatorProcessorImpl_16());
            TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultMAP, instanceIdentifier);
        }
    } catch (Throwable throwable) {
        throwable.printStackTrace(System.err);
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) BusinessActivityTerminator(com.arjuna.wst11.BusinessActivityTerminator) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) FaultedException(com.arjuna.wst.FaultedException) MAP(org.jboss.ws.api.addressing.MAP)

Aggregations

UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)61 SystemException (com.arjuna.wst.SystemException)57 WrongStateException (com.arjuna.wst.WrongStateException)40 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)35 ArrayList (java.util.ArrayList)18 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)16 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)14 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)13 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)13 SoapFault (com.arjuna.webservices.SoapFault)11 MAP (org.jboss.ws.api.addressing.MAP)11 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)8 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)7 FaultedException (com.arjuna.wst.FaultedException)6 BusinessActivityTerminator (com.arjuna.wst11.BusinessActivityTerminator)6 UserTransaction (com.arjuna.mw.wst11.UserTransaction)5 SoapFault11 (com.arjuna.webservices11.SoapFault11)5 InvalidActivityException (com.arjuna.mw.wsas.exceptions.InvalidActivityException)4 Context (com.arjuna.mw.wsc11.context.Context)3 TransactionManager (com.arjuna.mw.wst11.TransactionManager)3