File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Stateful bean and instance pooling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Stateful bean and instance pooling" Watch "Stateful bean and instance pooling" New topic

Stateful bean and instance pooling

Kalyan Anand
Ranch Hand

Joined: Feb 07, 2007
Posts: 194
Aren't the stateful bean instances pooled once the client calls remove method ?
Neha Kathuriaa

Joined: Sep 16, 2008
Posts: 25
You must destroy a stateful bean instance by using the @Remove annotation when the conversation ends. Any business method can be annotated with @Remove so that upon successful completion of that business
method, the bean instance will be destroyed. If you do not remove stateful bean instances when they are no longer needed,then the number of inactive (essentially dead) instances will grow, forcing passivation/
activation in the container.
In addition to @Remove, most containers provide the ability to time out and
destroy a bean instance by setting an expiration time in the vendor-specific deployment descriptor. This timeout can be used to help keep the number of bean instances to a manageable number. Its purpose is to set a timer for beans that are not used by clients for longer than the specified expiration time. It is recommended you take advantage of this timeout to reduce the time that unused bean instances hang around, soaking up space.

Source : EJB 3.0 in action : Debu Panda
I agree. Here's the link:
subject: Stateful bean and instance pooling
jQuery in Action, 3rd edition