Hi all I have a requirement of having a single EJB object in the EJB tier, this is basically to reduce the time taken to create EJB object as my EJB stores some static valeues. So I want something like this From Client side I will look up EJB, say EJB with JNDI name 'A' Then I will get an EJB object say 'objA' Some other client will lookup the EJB A Then I should get objA only. How do I achieve this? Thanks in anticipation Mrutyunjay
You could create the ejb as a wrapper to the singleton object. I.e. let the server create as many ejb objects as it wants. Each of them would then have a pointer to the singleton object. Note this prevents you from distributing this component across multiple JVM's. The preferred choice is to just create a stateless bean and allow the server to create as many beans as it needs. They only get instantiated once and the server can keep them in a pool to be used as needed. This allows the server to scale your application more readily.