Search in sources :

Example 1 with SyncImpl

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

the class ClientServerTransactionDUnitTest method doJTATx2.

private void doJTATx2(String regionName, CountDownLatch latch1, CountDownLatch latch2) {
    try {
        TransactionManagerImpl tm = TransactionManagerImpl.getTransactionManager();
        UserTransaction utx = new UserTransactionImpl();
        Region r = getClientRegion(regionName);
        utx.begin();
        r.put(key1, "value3");
        TransactionImpl txn = (TransactionImpl) tm.getTransaction();
        Synchronization sync = new SyncImpl();
        txn.registerSynchronization(sync);
        txn.notifyBeforeCompletionForTest();
        latch1.countDown();
        latch2.await();
        utx.rollback();
    } catch (Exception e) {
        latch1.countDown();
        Assert.fail("Unexpected exception while doing JTA Transaction2 ", e);
    }
}
Also used : UserTransaction(javax.transaction.UserTransaction) SyncImpl(org.apache.geode.internal.jta.SyncImpl) TransactionManagerImpl(org.apache.geode.internal.jta.TransactionManagerImpl) UserTransactionImpl(org.apache.geode.internal.jta.UserTransactionImpl) UserTransactionImpl(org.apache.geode.internal.jta.UserTransactionImpl) TransactionImpl(org.apache.geode.internal.jta.TransactionImpl) Synchronization(javax.transaction.Synchronization) RollbackException(javax.transaction.RollbackException)

Aggregations

RollbackException (javax.transaction.RollbackException)1 Synchronization (javax.transaction.Synchronization)1 UserTransaction (javax.transaction.UserTransaction)1 SyncImpl (org.apache.geode.internal.jta.SyncImpl)1 TransactionImpl (org.apache.geode.internal.jta.TransactionImpl)1 TransactionManagerImpl (org.apache.geode.internal.jta.TransactionManagerImpl)1 UserTransactionImpl (org.apache.geode.internal.jta.UserTransactionImpl)1