Search in sources :

Example 6 with UserTransactionImpl

use of org.apache.geode.internal.jta.UserTransactionImpl in project geode by apache.

the class ClientServerTransactionDUnitTest method doJTATx1.

private void doJTATx1(String regionName, CountDownLatch latch1, CountDownLatch latch2) {
    TransactionManagerImpl tm = TransactionManagerImpl.getTransactionManager();
    Region r = getClientRegion(regionName);
    try {
        UserTransaction utx = new UserTransactionImpl();
        utx.begin();
        latch1.await();
        r.put(key1, "value2");
        utx.commit();
        fail("Do not get expected RollbackException");
    } catch (Exception e) {
        if (e instanceof RollbackException) {
        // expected exception.
        } else {
            Assert.fail("Unexpected exception while doing JTA Transaction1 ", e);
        }
    } finally {
        latch2.countDown();
    }
}
Also used : UserTransaction(javax.transaction.UserTransaction) TransactionManagerImpl(org.apache.geode.internal.jta.TransactionManagerImpl) UserTransactionImpl(org.apache.geode.internal.jta.UserTransactionImpl) RollbackException(javax.transaction.RollbackException) RollbackException(javax.transaction.RollbackException)

Aggregations

UserTransactionImpl (org.apache.geode.internal.jta.UserTransactionImpl)6 UserTransaction (javax.transaction.UserTransaction)4 IOException (java.io.IOException)2 Context (javax.naming.Context)2 RollbackException (javax.transaction.RollbackException)2 SystemException (javax.transaction.SystemException)2 LogWriterI18n (org.apache.geode.i18n.LogWriterI18n)2 TransactionManagerImpl (org.apache.geode.internal.jta.TransactionManagerImpl)2 CompositeName (javax.naming.CompositeName)1 Name (javax.naming.Name)1 NameNotFoundException (javax.naming.NameNotFoundException)1 NotContextException (javax.naming.NotContextException)1 Synchronization (javax.transaction.Synchronization)1 SyncImpl (org.apache.geode.internal.jta.SyncImpl)1 TransactionImpl (org.apache.geode.internal.jta.TransactionImpl)1