int getTransactionManagerTimeout() throws SystemException { final TransactionManager tm = getTransactionManager(); if (tm instanceof TransactionTimeoutConfiguration) { return ((TransactionTimeoutConfiguration) tm).getTransactionTimeout(); } else if (tm instanceof TransactionManagerImple) { return ((TransactionManagerImple) tm).getTimeout(); } else { return 0; } }
@Test public void test () throws Exception { TransactionManagerImple tmi = new TransactionManagerImple(); assertEquals(tmi.getTransaction(), null); assertEquals(tmi.getObjectInstance(null, null, null, null), tmi); tmi.setTransactionTimeout(10); assertEquals(tmi.getTimeout(), 10); } }
@Test public void testJBossTS() throws Exception { TransactionManagerImple tm = new TransactionManagerImple(); tm.begin(); EntityManager em = factory.createEntityManager(); Tweet tweet = new Tweet( "Spice is the essence of life" ); em.persist( tweet ); tm.commit(); em.close(); tm.begin(); em = factory.createEntityManager(); FullTextEntityManager ftem = Search.getFullTextEntityManager( em ); em.remove( o ); tm.commit();
TransactionManagerImple tm = new TransactionManagerImple(); tm.resume(subordinateTransaction); subordinateTransaction.enlistResource(new XAResourceImple(XAResource.XA_RDONLY, XAResource.XA_OK)); subordinateTransaction.enlistResource(toCommit); Transaction suspend = tm.suspend(); tm.resume(subordinateTransaction); subordinateTransaction.doPrepare(); Transaction suspend = tm.suspend(); tm.resume(subordinateTransaction); subordinateTransaction.doCommit(); tm.suspend();
@Test public void test(){ TransactionManager tm = new TransactionManagerImple(); int i = 0; final AtomicInteger x = new AtomicInteger(0);
@Test public void testDisallowed() throws SystemException, NotSupportedException, RollbackException { final LastOnePhaseResource firstResource = new LastOnePhaseResource() ; final LastOnePhaseResource secondResource = new LastOnePhaseResource() ; final TransactionManager tm = new TransactionManagerImple() ; tm.begin() ; try { final Transaction tx = tm.getTransaction() ; assertTrue("First resource enlisted", tx.enlistResource(firstResource)) ; assertFalse("Second resource enlisted", tx.enlistResource(secondResource)) ; } finally { tm.rollback() ; } } }
/** * Get the transaction timeout. * * @return the timeout in seconds associated with this thread * @throws SystemException for any error */ public int getTransactionTimeout() throws SystemException { return getTransactionManager().getTimeout() ; }
@Test public void testAllowed() throws SystemException, NotSupportedException, RollbackException { final LastOnePhaseResource firstResource = new LastOnePhaseResource() ; final LastOnePhaseResource secondResource = new LastOnePhaseResource() ; final LastOnePhaseResource thirdResource = new LastOnePhaseResource() ; final TransactionManager tm = new TransactionManagerImple() ; tm.begin() ; try { final Transaction tx = tm.getTransaction() ; assertTrue("First resource enlisted", tx.enlistResource(firstResource)) ; assertTrue("Second resource enlisted", tx.enlistResource(secondResource)) ; assertTrue("Third resource enlisted", tx.enlistResource(thirdResource)) ; } finally { tm.rollback() ; } } }
/** * Get the transaction timeout. * * @return the timeout in seconds associated with this thread * @throws SystemException for any error */ public int getTransactionTimeout() throws SystemException { return getTransactionManager().getTimeout() ; }
/** * Get the transaction timeout. * * @return the timeout in seconds associated with this thread * @throws SystemException for any error */ public int getTransactionTimeout() throws SystemException { return getTransactionManager().getTimeout() ; }
int getTransactionManagerTimeout() throws SystemException { final TransactionManager tm = getTransactionManager(); if (tm instanceof TransactionTimeoutConfiguration) { return ((TransactionTimeoutConfiguration) tm).getTransactionTimeout(); } else if (tm instanceof TransactionManagerImple) { return ((TransactionManagerImple) tm).getTimeout(); } else { return 0; } }
int getTransactionManagerTimeout() throws SystemException { final TransactionManager tm = getTransactionManager(); if (tm instanceof TransactionTimeoutConfiguration) { return ((TransactionTimeoutConfiguration) tm).getTransactionTimeout(); } else if (tm instanceof TransactionManagerImple) { return ((TransactionManagerImple) tm).getTimeout(); } else { return 0; } }