Forums Register Login

EJB--threading

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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,
+Pie Number of slices to send: Send
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.
Something about .... going for a swim. With this tiny ad ...
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 776 times.
Similar Threads
Doubt in ThreadSafety
Doubt in Servlet threading
findbyprimarykey doubt
Doubt
Doubt in having instance varibales in servlets
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:30:05.