Search in sources :

Example 31 with WrongStateException

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

the class UserBusinessActivityImple 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 : TxContext(com.arjuna.mw.wst.TxContext) 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)

Example 32 with WrongStateException

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

the class BAParticipantManagerImple method exit.

public void exit() throws WrongStateException, UnknownTransactionException, SystemException {
    try {
        if (wstxLogger.logger.isTraceEnabled()) {
            wstxLogger.logger.trace(getClass().getSimpleName() + ".exit. Participant id: " + _participantId);
        }
        if (_hier == null)
            throw new UnknownTransactionException();
        _coordManager.resume(_hier);
        _coordManager.delistParticipant(_participantId);
        _coordManager.suspend();
    } catch (com.arjuna.mw.wsas.exceptions.NoActivityException ex) {
        throw new UnknownTransactionException();
    } catch (com.arjuna.mw.wscf.exceptions.InvalidParticipantException ex) {
        throw new SystemException("UnknownParticipantException");
    } catch (com.arjuna.mw.wsas.exceptions.WrongStateException ex) {
        throw new WrongStateException();
    } catch (InvalidActivityException ex) {
        throw new 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) WrongStateException(com.arjuna.wst.WrongStateException)

Example 33 with WrongStateException

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

the class UserBusinessActivityStandaloneImple method cancel.

public void cancel() throws UnknownTransactionException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        final String id = ctx.identifier();
        final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx);
        BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
        terminatorRPCStub.cancel();
    } catch (SystemException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    } finally {
        tidyup();
    }
}
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 34 with WrongStateException

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

the class UserBusinessActivityStandaloneImple method close.

public void close() throws TransactionRolledBackException, UnknownTransactionException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        final String id = ctx.identifier();
        final W3CEndpointReference terminatorCoordinatorRPC = getTerminationCoordinatorRPC(ctx);
        BusinessActivityTerminatorRPCStub terminatorRPCStub = new BusinessActivityTerminatorRPCStub(id, terminatorCoordinatorRPC);
        terminatorRPCStub.close();
    } catch (SystemException ex) {
        throw ex;
    } catch (TransactionRolledBackException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    } finally {
        tidyup();
    }
}
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) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) 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 35 with WrongStateException

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

the class MultiParticipantPrepareAndCommitTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    addDefaultBinding("service1", serviceURL1);
    UserTransaction tx = UserTransactionFactory.userTransaction();
    try {
        tx.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        tx.commit();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    }
    if (exception != null) {
        error("commit failure " + exception);
    }
    message("completed");
    isSuccessful = (exception == null);
}
Also used : UserTransaction(com.arjuna.mw.wst11.UserTransaction) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) ArrayList(java.util.ArrayList) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException)

Aggregations

WrongStateException (com.arjuna.wst.WrongStateException)43 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)42 SystemException (com.arjuna.wst.SystemException)41 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)28 ArrayList (java.util.ArrayList)18 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)16 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)14 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)12 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)9 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)9 Context (com.arjuna.mw.wsc11.context.Context)6 UserTransaction (com.arjuna.mw.wst11.UserTransaction)6 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)6 TxContext (com.arjuna.mw.wst.TxContext)5 InvalidActivityException (com.arjuna.mw.wsas.exceptions.InvalidActivityException)3 CannotRegisterException (com.arjuna.wsc.CannotRegisterException)3 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)3 InvalidStateException (com.arjuna.wsc.InvalidStateException)3 BusinessActivityTerminatorRPCStub (com.arjuna.wst11.stub.BusinessActivityTerminatorRPCStub)3 BusinessActivityTerminatorStub (com.arjuna.wst11.stub.BusinessActivityTerminatorStub)3