• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how session beans service simultaneous client calls

 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dears ..
I have a question about session beans(stateless/statefull):
if tow clients want access the same session beans,does the session beans service just one client , and when finish him, he will go to service the second one??.
rehards
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the case of stateless beans an instance serves each client call, it may or may not be the same instance, depending entirely on how the container responds. In the case of stateful beans, each client has its own instance, since the instance is tied to the session.
 
Alan Hermin
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dears..

in t he case of stateless session bean, it srvice each client call, when one client ends from the business method, the second one will be called..
right?

regards
[ October 02, 2007: Message edited by: Alaa Hendi ]
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The container will serialize calls to each call to a session bean instance. Each session bean instance will see a serialized sequence of method calls; so yes if two clients call the same method on a stateless session bean and are directed to the same instance of that bean by the container then the second call will have to wait until the first call has completed.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is common to create and maintain a pool of stateless session bean instances. Each client call will be serviced by an available instance (usually in a separate thread). The instance will remain active until the end of the method call, after which the EJB container will unbind the session bean from the client and return the instance to the pool for reuse.

If the container has no available instances and is prevented from creating new ones, then all client calls for the EJB class will be blocked until an instance becomes available. However, should the block eventually cause a timeout, the container will throw RemoteException for a remote client or an EJBException for a local client.
 
reply
    Bookmark Topic Watch Topic
  • New Topic