1 16 package org.mortbay.j2ee.session; 17 18 import java.rmi.RemoteException ; 19 20 import javax.naming.Context ; 21 import javax.naming.InitialContext ; 22 import javax.transaction.UserTransaction ; 23 24 26 28 31 public class 32 SerializableUserTransaction 33 implements java.io.Serializable  34 { 35 protected void 36 log_warn(String message) 37 { 38 System.err.println("WARNING: "+message); 39 } 40 41 protected void 42 log_error(String message, Exception e) 43 { 44 System.err.println("ERROR: "+message); 45 e.printStackTrace(System.err); 46 } 47 48 protected Context _ctx=null; 49 50 protected 51 SerializableUserTransaction() 52 throws RemoteException  53 { 54 } 55 56 SerializableUserTransaction(UserTransaction userTransaction) 57 throws RemoteException  58 { 59 log_warn("distribution of UserTransaction is NYI/Forbidden"); 60 } 61 62 UserTransaction  63 toUserTransaction() 64 throws RemoteException  65 { 66 try 67 { 68 return (UserTransaction )new InitialContext ().lookup("java:comp/UserTransaction"); 70 } 71 catch (Exception e) 72 { 73 log_error("could not lookup UserTransaction", e); 74 return null; 75 } 76 } 77 } 78 | Popular Tags |