Clients don't share EJBObjects, but the same bean can service multiple EJBObjects. Just npt at the same time.........
Does it mean that if two EJBObjects ask for a certain type of stateless session beans at the same time, there will be two beans coming up from the pool and service the EJBObjects?
Originally posted by Roger Chung-Wee:
The container is multi-threaded, so this is what happens. However, if there are not enough beans in the pool, I would think that the container will have to put the request on hold until a bean instance is free.
Clients are not allowed to make concurrent calls to a stateful session object. If a client-invoked business method is in progress on an instance when another client-invoked call, from the same or different client, arrives at the same instance of a stateful session bean class, the container may throw the java.rmi.RemoteException to the second client, if the client is a remote client, or the javax.ejb.EJBException, if the client is a local client. This restriction does not apply to a stateless session bean because the container routes each request to a different instance of the session bean class.
A container only needs to retain the number of instances required to service the current client load. Due to client "think time", this number is typically much smaller than the number of active clients. Passivation is not needed for stateless sessions. The container creates another stateless session bean instance if one is needed to handle an increase in client work load. If a stateless session bean is not needed to handle the current client work load, the container can destroy it.
why doesn't the container create a bean for that client?