1 25 26 package org.objectweb.easybeans.transaction; 27 28 import javax.naming.InitialContext ; 29 import javax.naming.NamingException ; 30 import javax.transaction.TransactionManager ; 31 32 import org.objectweb.easybeans.component.itf.TMComponent; 33 34 38 public final class JTransactionManager { 39 40 43 private JTransactionManager() { 44 45 } 46 47 50 private static TransactionManager tm = null; 51 52 56 public static TransactionManager getTransactionManager() { 57 if (tm != null) { 58 return tm; 59 } 60 61 try { 63 tm = (TransactionManager ) new InitialContext ().lookup(TMComponent.JNDI_NAME); 64 } catch (NamingException e) { 65 throw new IllegalStateException ("Cannot get transaction manager", e); 66 } 67 return tm; 68 } 69 } 70 | Popular Tags |