Help coderanch get a
new server
by contributing to the fundraiser
  • 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 ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

stateless session bean instances tracking

Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
We are using a JSP <--> (Stateless Session Beans)
EJB <--> DB to perform some simple calls. I have
called the 'beanObj.create()' in the JSP init() ie. this is done only once. In each request i am calling a method using the beanObj which retrives
data from the database.
While testing for 1000 requests I find the number
of connections to DB going upto 100. This is done
using the bean pool created by the container.
I would to know how is there are many instances of
the session bean being created as i have called
the 'beanObj.create()' in the init() ie. only
Posts: 3892
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
These beans are stateless. That means that all isntances are exactly alike to the EJB container and to the client as well.
When you send create() to the EJBHome of a stateless bean you're not REALLY creating any particular instance that a client holds on to -- you're just getting an abstract reference to that type of bean for the client. If you read the spec (or Richard Monson-Haefel's excellent book) you'll find that each method you call on a stateless session bean might go to a different instance.
So, since you are testing 1000 clients it makes perfectly good sense that the container would try to handle that by filling the bean pool so that all 100 beans int he pool can handle requests simultaneously.
The airline is called "Virgin"? Don't you want a plane to go all the way? This tiny ad will go all the way:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic