This content has been marked as final. Show 2 replies
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. 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.
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.
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.
Thanks for this explanation!