This content has been marked as final.
Show 2 replies
-
1. Re: EJB3 stateless session bean local proxy threading
alrubinger Oct 30, 2008 4:59 PM (in response to hjhjr4)JBoss EJB3 provides Thread-safe Proxies from JNDI. This may not be true in other implementations.
"EJB 3.0 Core Specification 4.7.11: Non-Reentrant Instances" wrote:
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 javax.ejb.ConcurrentAccessException to the second client[24]. If the EJB 2.1 client view is used, 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.[25]
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.
For SLSB, invocation may occur concurrently, though separate underlying bean instances will be used (as we pull only unused instances from a Pool.
For SFSB, invocation will block until the requisite session is available/unused. You may override this behaviour using the @SerializedConcurrentAccess annotation."hjhjr4" wrote:
ConfigurationEjb conf = context.lookup(...) //is this expensive???
Yes, cache your entries from JNDI for SLSB, and only perform a lookup on SFSB when you need a *new* session.
S,
ALR -
2. Re: EJB3 stateless session bean local proxy threading
hjhjr4 Oct 31, 2008 3:41 PM (in response to hjhjr4)Thanks for this explanation!