File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stateless session bean ejbRemove()

 
Adri Smith
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am actually kind of confused with the method ejbRemove(). I am wondering when exactly this method is called in case of a stateless session bean.

I would like to know if this method is called when the user call remove on the component interface or if it is called when the instance is killed from the pool. My guess is that is never called when the user call the remove method because the bean returns to the pool after each business call and therefore the client EJBObject never keeps a reference to the bean.

Thanks in advance,
Adri
 
Sanju Thomas
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, You are right. ejbRemove() method is never going to be called when the user invoke the remove method in the component interface. ejbRemove() method will be invoked by the container, when it need to reduce the size of the instance pool. So client will have no role in removing the bean instance from the pool. After each business method invocation the bean instance will go back to the pool.

Hope, this will help you.
 
Chengwei Lee
Ranch Hand
Posts: 884
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For stateless session beans, the clients do not have control over when the beans are created or destroyed. In the case of ejbCreate, the container will only invoke this method when the client invoke a business method. Likewise, the container decides when to call ejbRemove independently of the client.
 
Adri Smith
Ranch Hand
Posts: 76
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot to both for your responses.

This is definitely makes it clearer in my mind

Good luck if you are still preparing for the SCBCD
Adri
[ April 19, 2005: Message edited by: Adri Smith ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic