0 Replies Latest reply on Apr 1, 2011 6:05 AM by iaio81

    Caching new InitialContext() is possible?

    iaio81

      Hi all,

      in an application with many users now I invoke the EJB3 from client-side in this way:

       

      Properties properties = new Properties();

                    properties.put(Context.INITIAL_CONTEXT_FACTORY,

                            "org.jnp.interfaces.NamingContextFactory");

                    properties.put(Context.URL_PKG_PREFIXES,

                            "jboss.naming:org.jnp.interfaces");

                    properties.put(Context.PROVIDER_URL, "localhost");

                    try {

                        Context ctx = new InitialContext(properties);

                        bean = (......Remote) ctx.lookup("/......../"+...........RemoteJNDIName);

                    } catch (Exception ex) {

                        ex.printStackTrace();

                    }

       

       

      Could I cache ctx (context object) in order to not create it every time an user wants to do an EJB3's calling?

      Are there problems in a multi-user application in terms of synchronization or others?

      Which are the benifts of doing this?

       

       

      Thanks all!!