• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB--threading  RSS feed

 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all...
I have a doubt ......is EJB single threaded or multithreaded.
I read somewhere that according to EJB specification they are single threaded.......

Please clarify my doubt.

Thanks
Ramya
 
Nadeem Awad
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear ramya,
That's right, you can check the EJB 2.1 Specs, Section 7.12.10, Page 117:
7.12.10 Non-reentrant Instances
The container must ensure that only one thread can be executing an instance at any time. If a client request arrives for an instance while the instance is executing another request, the container may throw
the java.rmi.RemoteException to the second request if the client is a remote client, or the javax.ejb.EJBException if the client is a local client.
Note that a session object is intended to support only a single client. Therefore, it would be an application error if two clients attempted to invoke the same session object.
One implication of this rule is that an application cannot make loopback calls to a session bean instance.


Regards,
 
Balamaci Serban
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The container runs more instances of beans so it can service multiple clients, and these beans will run concurently, but each of these instances is single threaded(u can't start any threads inside an EJB). ->Multiple threads of single threaded instances.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!