1 package indyjug.jboss.ejb;
2 
3 public class OrderUtil
4 {
5     private static OrderLocalHome cachedLocalHome = null;
6 
7     /**
8      * Obtain local home interface from default initial context
9      * @return Local home interface for Mileage. Lookup using COMP_NAME
10     */
11    public static OrderLocalHome getLocalHome()
12        throws javax.naming.NamingException
13    {
14        // Local homes shouldn't be narrowed, as there is no RMI involved.
15        if (cachedLocalHome == null)
16        {
17            // Obtain initial context
18            javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
19
20            try
21            {
22                cachedLocalHome = (OrderLocalHome)initialContext.lookup(OrderLocalHome.COMP_NAME);
23            }
24            finally
25            {
26                initialContext.close();
27            }
28        }
29
30        return cachedLocalHome;
31    }
32}
33