@Override protected UserTransaction locateUserTransaction() { return this.transactionManager.getUserTransaction(); }
new ConfigurableJtaPlatform(jtaTm.getTransactionManager(), jtaTm.getUserTransaction(), jtaTm.getTransactionSynchronizationRegistry()));
/** * This implementation returns a JtaTransactionObject instance for the * JTA UserTransaction. * <p>The UserTransaction object will either be looked up freshly for the * current transaction, or the cached one looked up at startup will be used. * The latter is the default: Most application servers use a shared singleton * UserTransaction that can be cached. Turn off the "cacheUserTransaction" * flag to enforce a fresh lookup for every transaction. * @see #setCacheUserTransaction */ @Override protected Object doGetTransaction() { UserTransaction ut = getUserTransaction(); if (ut == null) { throw new CannotCreateTransactionException("No JTA UserTransaction available - " + "programmatic PlatformTransactionManager.getTransaction usage not supported"); } if (!this.cacheUserTransaction) { ut = lookupUserTransaction( this.userTransactionName != null ? this.userTransactionName : DEFAULT_USER_TRANSACTION_NAME); } return doGetJtaTransaction(ut); }
/** * This implementation returns a JtaTransactionObject instance for the * JTA UserTransaction. * <p>The UserTransaction object will either be looked up freshly for the * current transaction, or the cached one looked up at startup will be used. * The latter is the default: Most application servers use a shared singleton * UserTransaction that can be cached. Turn off the "cacheUserTransaction" * flag to enforce a fresh lookup for every transaction. * @see #setCacheUserTransaction */ @Override protected Object doGetTransaction() { UserTransaction ut = getUserTransaction(); if (ut == null) { throw new CannotCreateTransactionException("No JTA UserTransaction available - " + "programmatic PlatformTransactionManager.getTransaction usage not supported"); } if (!this.cacheUserTransaction) { ut = lookupUserTransaction( this.userTransactionName != null ? this.userTransactionName : DEFAULT_USER_TRANSACTION_NAME); } return doGetJtaTransaction(ut); }
new ConfigurableJtaPlatform(jtaTm.getTransactionManager(), jtaTm.getUserTransaction(), jtaTm.getTransactionSynchronizationRegistry()));
@Test public void serializable() throws Exception { UserTransaction ut1 = mock(UserTransaction.class); UserTransaction ut2 = mock(UserTransaction.class); TransactionManager tm = mock(TransactionManager.class); JtaTransactionManager jtam = new JtaTransactionManager(); jtam.setUserTransaction(ut1); jtam.setTransactionManager(tm); jtam.setRollbackOnCommitFailure(true); jtam.afterPropertiesSet(); SimpleNamingContextBuilder jndiEnv = SimpleNamingContextBuilder .emptyActivatedContextBuilder(); jndiEnv.bind(JtaTransactionManager.DEFAULT_USER_TRANSACTION_NAME, ut2); JtaTransactionManager serializedJtatm = (JtaTransactionManager) SerializationTestUtils .serializeAndDeserialize(jtam); // should do client-side lookup assertNotNull("Logger must survive serialization", serializedJtatm.logger); assertTrue("UserTransaction looked up on client", serializedJtatm .getUserTransaction() == ut2); assertNull("TransactionManager didn't survive", serializedJtatm .getTransactionManager()); assertEquals(true, serializedJtatm.isRollbackOnCommitFailure()); }
assertEquals(ut, ptm.getUserTransaction()); assertTrue(ptm.getUserTransaction() instanceof UserTransactionAdapter); UserTransactionAdapter uta = (UserTransactionAdapter) ptm.getUserTransaction(); assertEquals(tm, uta.getTransactionManager());
ptm.afterPropertiesSet(); assertEquals(ut, ptm.getUserTransaction()); assertEquals(tm, ptm.getTransactionManager());
ptm.afterPropertiesSet(); assertEquals(ut, ptm.getUserTransaction());
/** * This implementation returns a JtaTransactionObject instance for the * JTA UserTransaction. * <p>The UserTransaction object will either be looked up freshly for the * current transaction, or the cached one looked up at startup will be used. * The latter is the default: Most application servers use a shared singleton * UserTransaction that can be cached. Turn off the "cacheUserTransaction" * flag to enforce a fresh lookup for every transaction. * @see #setCacheUserTransaction */ protected Object doGetTransaction() { UserTransaction ut = getUserTransaction(); if (!this.cacheUserTransaction && this.userTransactionName != null) { ut = lookupUserTransaction(this.userTransactionName); } return doGetJtaTransaction(ut); }
new ConfigurableJtaPlatform(jtaTm.getTransactionManager(), jtaTm.getUserTransaction()));
/** * This implementation returns a JtaTransactionObject instance for the * JTA UserTransaction. * <p>The UserTransaction object will either be looked up freshly for the * current transaction, or the cached one looked up at startup will be used. * The latter is the default: Most application servers use a shared singleton * UserTransaction that can be cached. Turn off the "cacheUserTransaction" * flag to enforce a fresh lookup for every transaction. * @see #setCacheUserTransaction */ @Override protected Object doGetTransaction() { UserTransaction ut = getUserTransaction(); if (ut == null) { throw new CannotCreateTransactionException("No JTA UserTransaction available - " + "programmatic PlatformTransactionManager.getTransaction usage not supported"); } if (!this.cacheUserTransaction) { ut = lookupUserTransaction( this.userTransactionName != null ? this.userTransactionName : DEFAULT_USER_TRANSACTION_NAME); } return doGetJtaTransaction(ut); }
new ConfigurableJtaPlatform(jtaTm.getTransactionManager(), jtaTm.getUserTransaction(), jtaTm.getTransactionSynchronizationRegistry()));
/** * This implementation returns a JtaTransactionObject instance for the * JTA UserTransaction. * <p>The UserTransaction object will either be looked up freshly for the * current transaction, or the cached one looked up at startup will be used. * The latter is the default: Most application servers use a shared singleton * UserTransaction that can be cached. Turn off the "cacheUserTransaction" * flag to enforce a fresh lookup for every transaction. * @see #setCacheUserTransaction */ @Override protected Object doGetTransaction() { UserTransaction ut = getUserTransaction(); if (ut == null) { throw new CannotCreateTransactionException("No JTA UserTransaction available - " + "programmatic PlatformTransactionManager.getTransaction usage not supported"); } if (!this.cacheUserTransaction) { ut = lookupUserTransaction( this.userTransactionName != null ? this.userTransactionName : DEFAULT_USER_TRANSACTION_NAME); } return doGetJtaTransaction(ut); }
new ConfigurableJtaPlatform(jtaTm.getTransactionManager(), jtaTm.getUserTransaction(), jtaTm.getTransactionSynchronizationRegistry()).getJtaPlatformProxy());
&& this.jtaTransactionManager.getUserTransaction() != null) { return bean; } else if (this.transactionManager == null) {