4 Replies Latest reply on Apr 18, 2010 7:57 AM by henk de boer

    Are EJB client proxies thread-safe?

    David Balažic Newbie

      Hi!

       

      Is it safe to use the same local proxy by the multiple threads?

       

      Example:

      Properties properties = new Properties();
      properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      properties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      properties.put("java.naming.provider.url", "localhost");
      Context context = new InitialContext(properties);
      String lookupName = "project1/SomeBean/remote";
      SomeRemoteInterface proxy1 = (SomeRemoteInterface) context.lookup(lookupName);
      
      

       

      Can all thread of a client application use that proxy object to perform method calls?

      Is it (thread-)safe?

      Or should each thread make an own lookup to get an separate proxy object?

       

      The server we use is JBoss 4.2.3 and the client will also run on JBoss 4.2.3.

      The client is partly a web application (JSP pages).

       

      I googled, but I could not find a definite answer. (half of them misunderstand and talk about the server)

       

      Regards,

      David