0

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?

AdrianS
  • 1,980
  • 7
  • 33
  • 51

2 Answers2

0

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.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
0

EJB's consists of mainly the application logic at server side & are designed to perform operations irrespective of client application. In real-world enterprise applications, there can be various type of clients accessing them concurrently.

The EJB container manages every aspect of an enterprise bean at runtimes including remote access to the bean, security, persistence, transactions, concurrency, and access to and pooling of resources.

Container manages instances in the pool & is responsible for their addition/removal, increasing the size of pool real time.

Nayan Wadekar
  • 11,444
  • 4
  • 50
  • 73