Reentrant Issues

   

Session beans do not support concurrent access by multiple clients . Stateful session bean instances uniquely belong to a single client and stateless beans belong to a single client while a business method is being executed. The container enforces that only a single thread will be executing inside a session bean instance at a time. It's the responsibility of the container to serialize the requests , not the bean provider. This frees you from having to worry about concurrency issues related to your beans.

This behavior agrees with the overall purpose of session beans. That is that they are in theory just extensions of a client. Even though session beans are typically used as a service-oriented interface that hides or encapsulates a layer of entity beans, it doesn't make sense that multiple clients should be invoking methods on the same instance. Unlike entity beans, the EJB specification also does not allow a single client to make reentrant (loopback) calls to a session bean. If a remote client request arrives at an instance that is already in the middle of servicing a request, a RemoteException will be thrown to the second request. A local client would receive an EJBException in this situation.



Special Edition Using Enterprise JavaBeans 2.0
Special Edition Using Enterprise JavaBeans 2.0
ISBN: 0789725673
EAN: 2147483647
Year: 2000
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net