Search in sources :

Example 36 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException 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)

Example 37 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException 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 38 with UnknownTransactionException

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

the class CompletionRPCStub method commit.

public void commit() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
    final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
    boolean result;
    try {
        result = CompletionCoordinatorRPCClient.getClient().sendCommit(_completionCoordinator, map);
    } catch (final SoapFault soapFault) {
        if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
            throw new UnknownTransactionException(soapFault.getMessage());
        }
        throw new SystemException(soapFault.getMessage());
    } catch (final Exception e) {
        throw new SystemException(e.getMessage());
    } catch (final Throwable th) {
        th.printStackTrace();
        throw new SystemException(th.getMessage());
    }
    if (!result) {
        throw new TransactionRolledBackException();
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) SystemException(com.arjuna.wst.SystemException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) MAP(org.jboss.ws.api.addressing.MAP) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) SystemException(com.arjuna.wst.SystemException)

Example 39 with UnknownTransactionException

use of com.arjuna.wst.UnknownTransactionException 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)

Example 40 with UnknownTransactionException

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

the class MultiServicePrepareAndCommitTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    String serviceURL2;
    String serviceURL3;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    serviceURL2 = System.getProperty(XTSServiceTest.SERVICE_URL2_KEY);
    serviceURL3 = System.getProperty(XTSServiceTest.SERVICE_URL3_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    if (serviceURL2 == null) {
        serviceURL2 = "http://localhost:8080/xtstest/xtsservicetest2";
    }
    if (serviceURL3 == null) {
        serviceURL3 = "http://localhost:8080/xtstest/xtsservicetest3";
    }
    addDefaultBinding("service1", serviceURL1);
    addDefaultBinding("service2", serviceURL2);
    addDefaultBinding("service3", serviceURL3);
    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;
    }
    // invoke the service and tell it to prepare and  commit
    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("{service2}");
    commands.add("enlistDurable");
    commands.add("prepare");
    commands.add("commit");
    commands.add("next");
    commands.add("serve");
    commands.add("{service3}");
    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

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