Search in sources :

Example 1 with RollbackException

use of com.arjuna.ats.jta.exceptions.RollbackException in project narayana by jbosstm.

the class TestClient method doGet.

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String result = "OK";
    try {
        log.info("starting the transaction...");
        userTransaction.begin();
        log.info("transaction ID= " + userTransaction.toString());
        log.info("calling business Web Services...");
        testService.doNothing();
        log.info("terminating the transaction...");
        terminateTransaction(false);
    } catch (final RollbackException re) {
        log.info("Transaction rolled back");
        result = re.getClass().getName();
    } catch (Exception e) {
        log.info("problem: ", e);
        result = e.getClass().getName();
    }
    response.setContentType("text/plain");
    PrintWriter out = response.getWriter();
    out.println("finished : " + result);
    out.close();
}
Also used : RollbackException(com.arjuna.ats.jta.exceptions.RollbackException) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) RollbackException(com.arjuna.ats.jta.exceptions.RollbackException) PrintWriter(java.io.PrintWriter)

Example 2 with RollbackException

use of com.arjuna.ats.jta.exceptions.RollbackException in project narayana by jbosstm.

the class ExceptionsUnitTest method test.

@Test
public void test() throws Exception {
    InactiveTransactionException ex = new InactiveTransactionException();
    ex = new InactiveTransactionException("foobar");
    NotImplementedException exp = new NotImplementedException();
    exp = new NotImplementedException("foobar");
    exp = new NotImplementedException("foobar", new NullPointerException());
    exp = new NotImplementedException(new NullPointerException());
    RollbackException exp2 = new RollbackException();
    exp2 = new RollbackException("foobar");
    exp2 = new RollbackException("foobar", new NullPointerException());
    exp2 = new RollbackException(new NullPointerException());
    UnexpectedConditionException ex2 = new UnexpectedConditionException();
    ex2 = new UnexpectedConditionException("foobar");
}
Also used : NotImplementedException(com.arjuna.ats.jta.exceptions.NotImplementedException) UnexpectedConditionException(com.arjuna.ats.jta.exceptions.UnexpectedConditionException) RollbackException(com.arjuna.ats.jta.exceptions.RollbackException) InactiveTransactionException(com.arjuna.ats.jta.exceptions.InactiveTransactionException) Test(org.junit.Test)

Aggregations

RollbackException (com.arjuna.ats.jta.exceptions.RollbackException)2 InactiveTransactionException (com.arjuna.ats.jta.exceptions.InactiveTransactionException)1 NotImplementedException (com.arjuna.ats.jta.exceptions.NotImplementedException)1 UnexpectedConditionException (com.arjuna.ats.jta.exceptions.UnexpectedConditionException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 UnknownHostException (java.net.UnknownHostException)1 ServletException (javax.servlet.ServletException)1 Test (org.junit.Test)1