Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateful bean and instance pooling

 
Kalyan Anand
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aren't the stateful bean instances pooled once the client calls remove method ?
 
Neha Kathuriaa
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic