aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes stateless session bean instances tracking Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "stateless session bean instances tracking" Watch "stateless session bean instances tracking" New topic
Author

stateless session bean instances tracking

blr sam
Greenhorn

Joined: Jan 15, 2002
Posts: 7
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
once.
Cheers
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
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.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
jQuery in Action, 2nd edition
 
subject: stateless session bean instances tracking