Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Stateless session beans pool

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to everybody,
I've started studying EJB 3.0 and I have a doubt about stateless SessionBean pool: why should I have a lot of SessionBean instances even if they are stateless? Could not proxies invoke an unique SessionBean?

Thanks in advances
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Mirko Bonasorte:
Hi to everybody,
I've started studying EJB 3.0 and I have a doubt about stateless SessionBean pool: why should I have a lot of SessionBean instances even if they are stateless? Could not proxies invoke an unique SessionBean?

Thanks in advances



The reason is that the beans EJBContext carry information about the client that is requesting the service (method), and because each Session instance have its own EJBContext, the container need one session instance per client request.

This paragraph of "Enterprise Javabeans 3.0, O'Reilly, Chapter 3.1. Resource Management", might be useful:

When a bean instance is servicing a request, the EJBContext takes on new meaning. The EJBContext provides information about the client that is using the bean. It also provides the instance with access to its own EJB stub proxy, which is useful when the bean needs to pass references to itself or to other enterprise beans. So the EJBContext is not a static class; it is an interface to the container.



Hope this helps,
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Understood!
Thanks for your answer!
 
Let's go to the waterfront with this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic