[jboss-user] [EJB 3.0] - Re: EJB3 stateless session bean local proxy threading

ALRubinger do-not-reply at jboss.com
Thu Oct 30 16:59:58 EDT 2008


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

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4185825#4185825

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4185825



More information about the jboss-user mailing list