use of com.arjuna.wst.WrongStateException in project narayana by jbosstm.
the class UserTransactionImple method enlistCompletionParticipants.
/*
* Not sure if this is right as it doesn't map to registering a participant
* with the coordinator.
*/
private final void enlistCompletionParticipants() throws WrongStateException, UnknownTransactionException, SystemException {
TransactionManagerImple tm = (TransactionManagerImple) TransactionManager.getTransactionManager();
final TxContextImple currentTx = (TxContextImple) tm.currentTransaction();
if (currentTx == null)
throw new UnknownTransactionException();
final String id = currentTx.identifier();
final W3CEndpointReference completionParticipant = getCompletionParticipant(id, currentTx.isSecure());
W3CEndpointReference completionCoordinator = null;
try {
completionCoordinator = tm.registerParticipant(completionParticipant, AtomicTransactionConstants.WSAT_SUB_PROTOCOL_COMPLETION);
} catch (com.arjuna.wsc.InvalidProtocolException ex) {
ex.printStackTrace();
throw new SystemException(ex.toString());
} catch (com.arjuna.wsc.InvalidStateException ex) {
throw new WrongStateException();
} catch (com.arjuna.wsc.CannotRegisterException ex) {
// cause could actually be no activity or already registered
throw new UnknownTransactionException();
}
_completionCoordinators.put(id, completionCoordinator);
}
use of com.arjuna.wst.WrongStateException in project narayana by jbosstm.
the class BAParticipantManagerImple method cannotComplete.
public void cannotComplete() throws WrongStateException, UnknownTransactionException, SystemException {
if (wstxLogger.logger.isTraceEnabled()) {
wstxLogger.logger.trace(getClass().getSimpleName() + ".cannotComplete. Participant id: " + _participantId);
}
try {
if (_hier == null)
throw new UnknownTransactionException();
_coordManager.resume(_hier);
_coordManager.participantCannotComplete(_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.WrongStateException ex) {
throw new WrongStateException();
} 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());
}
}
use of com.arjuna.wst.WrongStateException in project narayana by jbosstm.
the class BAParticipantManagerImple method completed.
public void completed() throws WrongStateException, UnknownTransactionException, SystemException {
if (wstxLogger.logger.isTraceEnabled()) {
wstxLogger.logger.trace(getClass().getSimpleName() + ".completed. Participant id: " + _participantId);
}
try {
if (_hier == null)
throw new UnknownTransactionException();
_coordManager.resume(_hier);
_coordManager.participantCompleted(_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());
}
}
use of com.arjuna.wst.WrongStateException in project narayana by jbosstm.
the class UserBusinessActivityImple method beginSubordinate.
public void beginSubordinate(int timeout) throws WrongStateException, SystemException {
try {
TxContext current = _ctxManager.currentTransaction();
if ((current == null) || !(current instanceof TxContextImple))
throw new WrongStateException();
TxContextImple currentImple = (TxContextImple) current;
Context ctx = startTransaction(timeout, currentImple);
_ctxManager.resume(new TxContextImple(ctx));
// n.b. we don't enlist the subordinate transaction for completion
// that ensures that any attempt to commit or rollback will fail
} catch (com.arjuna.wsc.InvalidCreateParametersException ex) {
tidyup();
throw new SystemException(ex.toString());
} catch (com.arjuna.wst.UnknownTransactionException ex) {
tidyup();
throw new SystemException(ex.toString());
} catch (SystemException ex) {
tidyup();
throw ex;
}
}
use of com.arjuna.wst.WrongStateException in project narayana by jbosstm.
the class UserBusinessActivityImple 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 terminatorCoordinator = getTerminationCoordinator(ctx);
BusinessActivityTerminatorStub terminatorStub = new BusinessActivityTerminatorStub(id, terminatorCoordinator);
terminatorStub.complete();
} catch (SystemException ex) {
throw ex;
} catch (UnknownTransactionException ex) {
throw ex;
} catch (WrongStateException ex) {
throw ex;
} catch (Exception ex) {
throw new SystemException(ex.toString());
}
}
Aggregations