jQuery in Action, 3rd edition
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Stateless S Bean use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Stateless S Bean use" Watch "Stateless S Bean use" New topic

Stateless S Bean use

Christopher Arthur
Ranch Hand

Joined: Mar 09, 2004
Posts: 149
Here's just a simple question about these beans:
Suppose two clients want to use the same type of stateless session bean. They each have their EJBObjects and they both call a business methods through it at almost the same time.
Will the container pull two instances out of the pool so that they can each have their own bean, or will the client who gets there last just get an exception because the bean's in use?
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
The container will have a pool of session beans to handle requests from multiple clients. There isn't just one of them in the container to handle everything. That wouldn't be very good at all. At the very least, if the pool is empty, the container will just wait until one becomes available. The client won't be getting any sort of exceptions because of this.

Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The container is multi-threaded, so can spawn a thread to pull a method-ready bean from the pool to service each client concurrently. You'd need to configure the container to create the bean instances. For instance, WebLogic allows you to have up to 1,000 beans in the pool by using the max-beans-in-free-pool element in the weblogic-ejb-jar.xml file.

SCJP 1.4, SCWCD 1.3, SCBCD 1.3
I agree. Here's the link: http://aspose.com/file-tools
subject: Stateless S Bean use
jQuery in Action, 3rd edition