/** * Bind the currently configured user transaction implementation to the passed in * JNDI context. * @param initialContext * @throws javax.naming.NamingException */ public static void bindJTAUserTransactionImplementation(InitialContext initialContext) throws javax.naming.NamingException { /** Look up and instantiate an instance of the configured user transaction implementation **/ String utImplementation = jtaPropertyManager.getJTAEnvironmentBean().getJtaUTImplementation(); /** Bind the user transaction to the appropriate JNDI context **/ Reference ref = new Reference(utImplementation, utImplementation, null); initialContext.rebind(getUserTransactionJNDIName(), ref); }
/** * Retrieve the singleton UserTransaction reference. * * @param reset if <code>true</code> then ignore any previous cached implementation * and get a new instance. * @return The singleton UserTransaction reference. Can return null if the * instantiation failed. */ public static synchronized javax.transaction.UserTransaction userTransaction (boolean reset) { try { if ((_userTransaction == null) || (reset)) { _userTransaction = (javax.transaction.UserTransaction) Thread.currentThread().getContextClassLoader().loadClass(jtaPropertyManager.getJTAEnvironmentBean().getJtaUTImplementation()).newInstance(); } } catch (Exception e) { if (jtaLogger.loggerI18N.isErrorEnabled()) { jtaLogger.loggerI18N.error("com.arjuna.ats.jta.UserTransaction.generalfailure", e); } } return _userTransaction; }