Web design course - props.put(Context.INITIAL_CONTEXT_FACTORY, jndiParams.get(Context.INITIAL_CONTEXT_FACTORY)); props.put(Context.PROVIDER_URL, jndiParams.get(Context.PROVIDER_URL)); ctx = new InitialContext(props);
Saturday, October 13th, 2007props.put(Context.INITIAL_CONTEXT_FACTORY, jndiParams.get(Context.INITIAL_CONTEXT_FACTORY)); props.put(Context.PROVIDER_URL, jndiParams.get(Context.PROVIDER_URL)); ctx = new InitialContext(props); } else { // Use default provider ctx = new InitialContext( ); } } catch( IOException ex ){ // Use default provider ctx = new InitialContext( ); } } /** * Get the Singleton instance of the class. */ public static EJBHomeFactory getInstance( ) throwsNamingException { if (singleton == null) { singleton = new EJBHomeFactory( ); } return singleton; } /** * Specify the JNDI name and class for the desired homeinterface. */ public EJBHome lookupHome(String jndiName, Class homeClass) throws NamingException { EJBHome home = (EJBHome)homes.get(homeClass); if (home == null) { home = (EJBHome)PortableRemoteObject.narrow(ctx.lookup( jndiName), homeClass); // Cache the home for repeated use homes.put(homeClass, home); } return home; } } The getInstance method of EJBHomeFactory differs from most Singleton implementations in that it isn’t declared to be synchronized. As discussed in EJBDesignPatterns, using a synchronized method here would degrade performance without providing any significant benefit in return. If multiple instances of EJBHomeFactory are instantiated due to simultaneous calls to getInstance during initialization, some redundant
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.