Search in sources :

Example 1 with CompletionStub

use of com.arjuna.wst11.stub.CompletionStub in project narayana by jbosstm.

the class UserTransactionImple method commitWithoutAck.

private final void commitWithoutAck() throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    String id = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        id = ctx.identifier();
        /*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
        final W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
        if (completionCoordinator == null)
            throw new WrongStateException();
        CompletionStub completionStub = new CompletionStub(id, completionCoordinator);
        completionStub.commit();
    } catch (SystemException ex) {
        throw ex;
    } catch (TransactionRolledBackException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (SecurityException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    } finally {
        try {
            if (ctx != null)
                _ctxManager.resume(ctx);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if (id != null)
            _completionCoordinators.remove(id);
    }
}
Also used : CompletionStub(com.arjuna.wst11.stub.CompletionStub) 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.at.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 2 with CompletionStub

use of com.arjuna.wst11.stub.CompletionStub in project narayana by jbosstm.

the class UserTransactionStandaloneImple method commitWithoutAck.

private final void commitWithoutAck() throws TransactionRolledBackException, UnknownTransactionException, SecurityException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    String id = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        id = ctx.identifier();
        /*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
        final W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
        if (completionCoordinator == null)
            throw new WrongStateException();
        CompletionRPCStub completionStub = new CompletionRPCStub(id, completionCoordinator);
        completionStub.commit();
    } catch (SystemException ex) {
        throw ex;
    } catch (TransactionRolledBackException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (SecurityException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        ex.printStackTrace();
        throw new SystemException(ex.toString());
    } finally {
        try {
            if (ctx != null)
                _ctxManager.resume(ctx);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if (id != null)
            _completionCoordinators.remove(id);
    }
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CompletionRPCStub(com.arjuna.wst11.stub.CompletionRPCStub) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) CannotRegisterException(com.arjuna.wsc.CannotRegisterException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidStateException(com.arjuna.wsc.InvalidStateException) InvalidProtocolException(com.arjuna.wsc.InvalidProtocolException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException)

Example 3 with CompletionStub

use of com.arjuna.wst11.stub.CompletionStub in project narayana by jbosstm.

the class UserTransactionStandaloneImple method abortWithoutAck.

private final void abortWithoutAck() throws UnknownTransactionException, SecurityException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    String id = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        id = ctx.identifier();
        /*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
        W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
        if (completionCoordinator == null)
            throw new WrongStateException();
        CompletionRPCStub completionStub = new CompletionRPCStub(id, completionCoordinator);
        completionStub.rollback();
    } catch (SystemException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (SecurityException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    } finally {
        try {
            if (ctx != null)
                _ctxManager.resume(ctx);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if (id != null)
            _completionCoordinators.remove(id);
    }
}
Also used : SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) WrongStateException(com.arjuna.wst.WrongStateException) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) CompletionRPCStub(com.arjuna.wst11.stub.CompletionRPCStub) TxContextImple(com.arjuna.mwlabs.wst11.at.context.TxContextImple) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) CannotRegisterException(com.arjuna.wsc.CannotRegisterException) WrongStateException(com.arjuna.wst.WrongStateException) SystemException(com.arjuna.wst.SystemException) InvalidStateException(com.arjuna.wsc.InvalidStateException) InvalidProtocolException(com.arjuna.wsc.InvalidProtocolException) InvalidCreateParametersException(com.arjuna.wsc.InvalidCreateParametersException) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException)

Example 4 with CompletionStub

use of com.arjuna.wst11.stub.CompletionStub in project narayana by jbosstm.

the class UserTransactionImple method abortWithoutAck.

private final void abortWithoutAck() throws UnknownTransactionException, SecurityException, SystemException, WrongStateException {
    TxContextImple ctx = null;
    String id = null;
    try {
        ctx = (TxContextImple) _ctxManager.suspend();
        if (ctx == null) {
            throw new WrongStateException();
        }
        id = ctx.identifier();
        /*
			 * By default the completionParticipantURL won't be set for an interposed (imported)
			 * bridged transaction. This is fine, because you shouldn't be able to commit that
			 * transaction from a node in the tree, only from the root. So, we can prevent commit
			 * or rollback at this stage. The alternative would be to setup the completionParticipantURL
			 * and throw the exception from the remote coordinator side (see enlistCompletionParticipants
			 * for how to do this).
			 *
			 * The same applies for an interposed subordinate transaction created via beginSubordinate.
			 */
        W3CEndpointReference completionCoordinator = (W3CEndpointReference) _completionCoordinators.get(id);
        if (completionCoordinator == null)
            throw new WrongStateException();
        CompletionStub completionStub = new CompletionStub(id, completionCoordinator);
        completionStub.rollback();
    } catch (SystemException ex) {
        throw ex;
    } catch (UnknownTransactionException ex) {
        throw ex;
    } catch (SecurityException ex) {
        throw ex;
    } catch (WrongStateException ex) {
        throw ex;
    } catch (Exception ex) {
        throw new SystemException(ex.toString());
    } finally {
        try {
            if (ctx != null)
                _ctxManager.resume(ctx);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        if (id != null)
            _completionCoordinators.remove(id);
    }
}
Also used : CompletionStub(com.arjuna.wst11.stub.CompletionStub) 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.at.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)

Aggregations

TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)4 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)4 SystemException (com.arjuna.wst.SystemException)4 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)4 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)4 WrongStateException (com.arjuna.wst.WrongStateException)4 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)4 CannotRegisterException (com.arjuna.wsc.CannotRegisterException)2 InvalidProtocolException (com.arjuna.wsc.InvalidProtocolException)2 InvalidStateException (com.arjuna.wsc.InvalidStateException)2 CompletionRPCStub (com.arjuna.wst11.stub.CompletionRPCStub)2 CompletionStub (com.arjuna.wst11.stub.CompletionStub)2