From the other thread, that probably oughtta be closed ...
Yes, I am concerned about thread-safety as provided by the container, and when does the developer need to create threads themselves and take care of threading.
So is it correct to say that EJBs should be coded for a single thread and the container will manage/create multiple threads as required?
The 2nd paragraph is right on - the container does a lot of nifty stuff with threads, so the answer to the 1st paragraph is we should not do anything with threads. The container wants to manage threads entirely and if we go about creating them and locking them it can't do its job as well. The EJB spec and maybe the Servlet spec (I'd have to look on that one) tell you not to create threads.
Because that's rather restrictive, some container vendors have added some non-standard way to work with threads. I remember reading up on one in WebSphere but never used it. JMS queuing is another standard way to spawn an asynchronous task.
I've broken the rules in the past with a limited amount of very carefully controlled thread work, and gotten away with it so far.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Don't sweat petty things, or pet sweaty things. But cuddle this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database