1 4 package org.jboss.test.cmp2.cmrstress.interfaces; 5 6 9 public class ParentUtil 10 { 11 12 private static org.jboss.test.cmp2.cmrstress.interfaces.ParentHome cachedRemoteHome = null; 13 14 15 private static org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome cachedLocalHome = null; 16 17 19 23 public static org.jboss.test.cmp2.cmrstress.interfaces.ParentHome getHome() throws javax.naming.NamingException 24 { 25 if (cachedRemoteHome == null) { 26 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (); 28 try { 29 java.lang.Object objRef = initialContext.lookup(org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.JNDI_NAME); 30 cachedRemoteHome = (org.jboss.test.cmp2.cmrstress.interfaces.ParentHome) javax.rmi.PortableRemoteObject.narrow(objRef, org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.class); 31 } finally { 32 initialContext.close(); 33 } 34 } 35 return cachedRemoteHome; 36 } 37 38 43 public static org.jboss.test.cmp2.cmrstress.interfaces.ParentHome getHome( java.util.Hashtable environment ) throws javax.naming.NamingException 44 { 45 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (environment); 47 try { 48 java.lang.Object objRef = initialContext.lookup(org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.JNDI_NAME); 49 return (org.jboss.test.cmp2.cmrstress.interfaces.ParentHome) javax.rmi.PortableRemoteObject.narrow(objRef, org.jboss.test.cmp2.cmrstress.interfaces.ParentHome.class); 50 } finally { 51 initialContext.close(); 52 } 53 } 54 55 59 public static org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome getLocalHome() throws javax.naming.NamingException 60 { 61 if (cachedLocalHome == null) { 63 javax.naming.InitialContext initialContext = new javax.naming.InitialContext (); 65 try { 66 cachedLocalHome = (org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome) initialContext.lookup(org.jboss.test.cmp2.cmrstress.interfaces.ParentLocalHome.JNDI_NAME); 67 } finally { 68 initialContext.close(); 69 } 70 } 71 return cachedLocalHome; 72 } 73 74 } | Popular Tags |