This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, It might be a dumb question. I don't see any importance of pooling stateless beans.
Why not a stateless bean is singleton (one per server in cluster environment).
I have got this doubt till now somany times but no one can clear this. I would be thankful,if any one of you can help me in explaining main differences.
Whenever I implement a stateless bean, the work is almost like a singleton. Actually I gain performance with singleton (ofcourse). Then why should I use stateless beans in my environment.
One scenario is, I have configurator-component which needs to read configuration from file. Ofcourse this is singleton. why this component needs to be a stateless?
Thanks in advance, Jelda
"If you have an apple and I have an apple and we exchange apples then you and I will still each have one apple. But if you have an idea and I have an idea and we exchange these ideas, then each of us will have two ideas." -George Bernard Shaw
Jelda, The stateless sesion bean can take care of transactions for the client. So while the SSB is executing, only one user can be in it at a time. For a singleton, this would mean you could have only one user in the system. That would bring concurrency to a grinding halt.
This is more a matter of threading, I think. Unlike a servlet, which is typically instantiated once and then accessed by multiple threads, a session bean instance is accessed by a single thread. The EJB container creates as many bean instances as needed for concurrent requests (each running in a thread), usually subject to a user-defined maximum number.
So, it usually makes no sense to limit the number of instances to one, as this would cause the container to serialize requests to that instance and cause poor performance.
Hi, I am not sure whether this is right thread to ask for some help. Since this topic( threading and related issues for an EJB environment) is very important, can somebody point me to a resource which discusses this thouroughly?