1 43 44 package org.objectweb.jotm; 45 46 import java.util.Hashtable ; 47 import javax.naming.Context ; 48 import javax.naming.Name ; 49 import javax.naming.Reference ; 50 import javax.naming.spi.ObjectFactory ; 51 52 public class UserTransactionFactory implements ObjectFactory { 53 54 public Object getObjectInstance(Object objref, Name name, Context ctx, Hashtable env) throws Exception { 55 56 Reference ref = (Reference ) objref; 57 Current ut = null; 58 59 if (ref.getClassName().equals("javax.transaction.UserTransaction") 60 || ref.getClassName().equals("org.objectweb.jotm.Current")) { 61 62 ut = Current.getCurrent(); 65 66 if (ut == null) { 67 ut = new Current(); 68 69 String timeoutStr = (String ) ref.get("jotm.timeout").getContent(); 71 Integer i = new Integer (timeoutStr); 72 int timeout = i.intValue(); 73 ut.setDefaultTimeout(timeout); 74 } 75 } 76 return ut; 77 } 78 } 79 | Popular Tags |