Originally posted by Aditya Jha:
Actually, this is the crux of the problem. Even though one instance would suffice in case of multi-threading, JVM specification ensures that a particular instance can serve only ONE client at any given point of time.
- Aditya Jha
One you say one "Client" what exactly do you mean - do you mean one "thread" ?
Since you mention "Even though one instance would suffice in case of multi-threading" I would think this would pretty much negate the need for a stateless session bean pool assuming you could use Singleton instances?
The only way I see it maybe having some value would be in a case where a single user's
thread would try to use more than one instance of a stateless session bean? In real life when would this ever happen (unless maybe by accident of poor design?) OR I guess if you didn't want to use a singleton pojo, a stateless session bean pool could help.
I'm trying to find a concrete example of where a stateless session bean pool helps over using a singleton pojo?
I ask this also from a practical matter since I'll be leveraging EJB3 MDBs in an application and I'm debating whether I should even bother also using stateless session beans for the other beans that my
servlet layer might use. Since all the calls will be local I'm wondering if I'm gaining anything by using a stateless session bean as far as performance and scalability go as opposed to using simple singleton pojos (Spring injected?) for this layer.
Thanks for some more clarity on this issue.