EJB programming & troubleshooting: stateless EJB and concurrency

  1. stateless EJB and concurrency (2 messages)

    supposed I have a stateless EJB running in one application server (not in network deployment / cluster) what does the J2EE spec defines about the following issues: * 2 requests will be executed in to threads in the same JVM * 2 requests will be executed in 2 different JVMs 10x Yonatan
  2. where can i find the resource related.[ Go to top ]

  3. Re: stateless EJB and concurrency[ Go to top ]

    Hi, I'm not sure I understand the question, but I'll give it a try anyway... I guess you refer to the following 2 conditions: 1. two client threads in the same JVM as the EJB container invoking the same method on the Local interface (same JVM==>Local interface). ...as opposed to... 2. two clients in two separate JVMs, both invoking the same method on the Remote interface (different JVM than the EJB container==>Remote interface). The behavior will be similar (aside from the serialization, different transaction coordination etc involved in Remote calls). The container will take any instance from the pool of that stateless EJB for each method call, and assign it to that method call only. In case the second invocation arrives in the EJB container before the first invocation has finished running, the chances that the EJB container will hand the second invocation with the same EJB instance are 0. This is the only guarantee when talking about stateless session beans: The container guarantees that the entire bean instance is dedicated to a client invoking a method on it and only to that client for the entire duration of a single method invocation. The second method invocation (even next line of code, no lookup or anything in between) can get a different instance. HTH... Amit.