aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Question on role of threads in EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Question on role of threads in EJB" Watch "Question on role of threads in EJB" New topic
Author

Question on role of threads in EJB

Aarati Manel
Greenhorn

Joined: Aug 17, 2010
Posts: 12
In case of Servlet - if 10 clients are accessing the servlet then there will be only 1 servlet instance and 10 threads get created in the container, which are accessed by 10 clients.

Now In case of EJB- consider 10 clients sending message to JMS Queue and OpenAccountMDB consumes the message and calls the OpenAccountBean session bean method.
Then in this scenario container pulls 10 OpenAccountMDB instances from the pool and creates 10 OpenAccountBean session bean instances.
Then is there any role of threading in EJB ? like Servlet has? What kind of multi threading is taken care by EJB container?

Rishi Shehrawat
Ranch Hand

Joined: Aug 11, 2010
Posts: 218

The container takes care of threading. In the case of MDB's the number of threads spawned to porcess depend on the configuraiton for consumers. You could have set this value to 1 in case you wanted just one message to be processed at one time & in this case the container would have spawned just one thread.
 
Don't get me started about those stupid light bulbs.
 
subject: Question on role of threads in EJB