This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
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?
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.