Search code examples
multithreadingconcurrencyejbpoolapplication-client

EJB pool while calling EJB from client app


Is it ok if i inject an EJB in the application client through JNDI, and then call this EJB from multiple threads ?

Will the j2ee container know to create more ejb to handle more requests ?

OR do i have to inject the EJB through JNDI in every thread?


Solution

  • When you look up an EJB, the result is an EJB proxy. It is safe to reuse an EJB proxy in multiple threads. The container is responsible for synchronization and pool of EJB instances.