Search in sources :

Example 31 with SystemException

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

the class BusinessActivityTerminatorStub method close.

public void close() throws TransactionRolledBackException, 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().sendClose(_terminationCoordinator, map, new InstanceIdentifier(_id));
        callback.waitUntilTriggered();
    } catch (final Throwable th) {
        throw new SystemException();
    } finally {
        terminationParticipantProcessor.removeCallback(_id);
    }
    if (callback.hasTriggered()) {
        if (callback.receivedClosed()) {
            return;
        }
        final SoapFault soapFault = callback.getSoapFault();
        if (soapFault != null) {
            final QName subcode = soapFault.getSubcode();
            if (ArjunaTXConstants.TRANSACTIONROLLEDBACK_ERROR_CODE_QNAME.equals(subcode)) {
                throw new TransactionRolledBackException();
            } else 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) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) MAP(org.jboss.ws.api.addressing.MAP) TerminationParticipantProcessor(com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor)

Example 32 with SystemException

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

the class CompletionStub method commit.

public void commit() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
    final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
    final CompletionStub.RequestCallback callback = new CompletionStub.RequestCallback();
    final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor();
    completionInitiator.registerCallback(_id, callback);
    try {
        CompletionCoordinatorClient.getClient().sendCommit(_completionCoordinator, map, new InstanceIdentifier(_id));
        callback.waitUntilTriggered();
    } catch (final Throwable th) {
        th.printStackTrace();
        throw new SystemException();
    } finally {
        completionInitiator.removeCallback(_id);
    }
    if (callback.hasTriggered()) {
        if (callback.receivedCommitted()) {
            return;
        } else if (callback.receivedAborted()) {
            throw new TransactionRolledBackException();
        }
        final SoapFault soapFault = callback.getSoapFault();
        if ((soapFault != null) && ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
            throw new UnknownTransactionException();
        }
    }
    throw new SystemException();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) MAP(org.jboss.ws.api.addressing.MAP)

Example 33 with SystemException

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

the class CompletionStub method rollback.

public void rollback() throws UnknownTransactionException, SystemException {
    final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
    final CompletionStub.RequestCallback callback = new CompletionStub.RequestCallback();
    final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor();
    completionInitiator.registerCallback(_id, callback);
    try {
        CompletionCoordinatorClient.getClient().sendRollback(_completionCoordinator, map, new InstanceIdentifier(_id));
        callback.waitUntilTriggered();
    } catch (final Throwable th) {
        th.printStackTrace();
        throw new SystemException();
    } finally {
        completionInitiator.removeCallback(_id);
    }
    if (callback.hasTriggered()) {
        if (callback.receivedAborted()) {
            return;
        }
        final SoapFault soapFault = callback.getSoapFault();
        if ((soapFault != null) && ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
            throw new UnknownTransactionException();
        }
    }
    throw new SystemException();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP)

Example 34 with SystemException

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

the class SingleParticipantCompletionParticipantCloseTest 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);
    UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
    try {
        ba.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> resultsList;
    String participantId;
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P1");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("completed");
    commands.add("{P1}");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        ba.close();
    } catch (TransactionRolledBackException e) {
        exception = e;
    } catch (UnknownTransactionException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    } catch (WrongStateException e) {
        exception = e;
    }
    if (exception != null) {
        error("close failure " + exception);
    }
    message("finished");
    isSuccessful = (exception == null);
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) UserBusinessActivity(com.arjuna.mw.wst11.UserBusinessActivity) 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 35 with SystemException

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

the class MultiParticipantParticipantCompletionParticipantCloseTest method run.

public void run() {
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
    // ignore
    }
    String serviceURL1;
    String subserviceURL1;
    serviceURL1 = System.getProperty(XTSServiceTest.SERVICE_URL1_KEY);
    if (serviceURL1 == null) {
        serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
    }
    subserviceURL1 = System.getProperty(XTSServiceTest.SUBORDINATE_SERVICE_URL1_KEY);
    if (subserviceURL1 == null) {
        subserviceURL1 = "http://localhost:8080/xtstest/xtssubordinateservicetest1";
    }
    addDefaultBinding("service1", serviceURL1);
    addDefaultBinding("subservice1", subserviceURL1);
    UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();
    try {
        ba.begin();
    } catch (WrongStateException e) {
        exception = e;
    } catch (SystemException e) {
        exception = e;
    }
    if (exception != null) {
        error("txbegin failure " + exception);
        return;
    }
    List<String> resultsList;
    String participantId;
    List<String> commands = new ArrayList<String>();
    List<String> results = new ArrayList<String>();
    commands.add("block");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P1");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P2");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("enlistParticipantCompletion");
    commands.add("close");
    commands.add("bindings");
    commands.add("bind");
    commands.add("P3");
    commands.add("0");
    commands.add("next");
    commands.add("serve");
    commands.add("{service1}");
    commands.add("completed");
    commands.add("{P1}");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("completed");
    commands.add("{P2}");
    commands.add("next");
    commands.add("serve");
    commands.add("{subservice1}");
    commands.add("completed");
    commands.add("{P3}");
    commands.add("endblock");
    try {
        processCommands(commands, results);
    } catch (Exception e) {
        exception = e;
    }
    if (exception != null) {
        error("test failure " + exception);
        return;
    }
    try {
        ba.close();
    } 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 : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) UserBusinessActivity(com.arjuna.mw.wst11.UserBusinessActivity) 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

SystemException (com.arjuna.wst.SystemException)74 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)63 WrongStateException (com.arjuna.wst.WrongStateException)45 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)39 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)20 ArrayList (java.util.ArrayList)19 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)16 UserBusinessActivity (com.arjuna.mw.wst11.UserBusinessActivity)15 SoapFault (com.arjuna.webservices.SoapFault)15 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)13 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)11 TxContextImple (com.arjuna.mwlabs.wst11.ba.context.TxContextImple)11 MAP (org.jboss.ws.api.addressing.MAP)11 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)10 Context (com.arjuna.mw.wsc11.context.Context)6 FaultedException (com.arjuna.wst.FaultedException)6 BusinessActivityTerminator (com.arjuna.wst11.BusinessActivityTerminator)6 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 TxContext (com.arjuna.mw.wst.TxContext)5 BusinessActivityManager (com.arjuna.mw.wst11.BusinessActivityManager)5