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;
}
}
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());
}
}
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();
}
}
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();
}
}
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);
}
Aggregations