Search in sources :

Example 1 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 2 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 3 with UnknownTransactionException

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

the class BAParticipantManagerImple method fail.

public void fail(final QName exceptionIdentifier) throws SystemException {
    if (wstxLogger.logger.isTraceEnabled()) {
        wstxLogger.logger.trace(getClass().getSimpleName() + ".fail. Participant id: " + _participantId + ", exceptionIdentifier: " + exceptionIdentifier);
    }
    try {
        if (_hier == null)
            throw new UnknownTransactionException();
        _coordManager.resume(_hier);
        // fail means faulted as far as the coordinator manager is concerned
        _coordManager.participantFaulted(_participantId);
        _coordManager.suspend();
    } catch (final InvalidActivityException iae) {
        throw new SystemException("UnknownTransactionException");
    } catch (final UnknownTransactionException ute) {
        throw new SystemException("UnknownTransactionException");
    } catch (com.arjuna.mw.wscf.exceptions.InvalidParticipantException ex) {
        throw new SystemException("UnknownParticipantException");
    } catch (com.arjuna.mw.wsas.exceptions.NoActivityException ex) {
        throw new SystemException("UnknownTransactionException");
    } catch (com.arjuna.mw.wsas.exceptions.SystemException ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : InvalidActivityException(com.arjuna.mw.wsas.exceptions.InvalidActivityException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException)

Example 4 with UnknownTransactionException

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

the class UserBusinessActivityStandaloneImple method complete.

public void complete() throws UnknownTransactionException, SystemException, WrongStateException {
    try {
        final TxContextImple ctx = ((TxContextImple) _ctxManager.currentTransaction());
        if (ctx == null) {
            throw new WrongStateException();
        }
        final String id = ctx.identifier();
        final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx);
        BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
        terminatorRPCStub.complete();
    } catch (SystemException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    }
}
Also used : BusinessActivityTerminatorRPCStub(com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) TxContextImple(com.arjuna.mwlabs.wst11.ba.context.TxContextImple) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException)

Example 5 with UnknownTransactionException

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

the class UserBusinessActivityStandaloneImple 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));
    } 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.ba.context.TxContextImple) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException)

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