Can EJBHomeFactory be called concurrently?

Discussions

EJB design: Can EJBHomeFactory be called concurrently?

  1. Can EJBHomeFactory be called concurrently? (4 messages)

    Since EJBHomeFactory is a singleton pattern, it has only one instance of the class, if I choose the 3-tier archetecture, that is, I will deploy the JSP,Servlets and EJBs in the same server, and if many servlets(for example, more than 500 clients) call the EJBHomeFactory at the same time, what will happen? All the servlets will find the EJBHomes concurrently? Or should they be in a queue to get the access to the only instance of the EJBHomeFactory class? 3x!!
  2. The the purpose of using factory. To lookup (JNDI) the Home interface once, cache it and get it via the factory class. Any call except the first should return very quickly so it should cause problems to concurrent access.
  3. One of the main reasons to use EJBs is to avoid any concurrency issues.
    The HomeFactory needs to be written as thread-safe singleton is all (you will find lots of documentation about this on the web - try avoiding synchronization on the getHome(XXXX) and getInstance() methods).
    BTW: Keep in mind, that a Singleton is not really a Singleton in J2EE (and other distributed technologies).
  4. then, if my system is to serve hundreds of clients at once, is there any better solutions to the problem? Thanks a lot!
  5. Can EJBHomeFactory be called concurrently?[ Go to top ]

    it only only need sync for the first time to get the home.
    for the subsequence call is not needed.
    so I did not see problem here to serve 500 clients.