• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Remove methods

 
Fisher Daniel
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
As we know that some vendor of EJB container create a pool for EJB instances, is it possible that our stateless session beans have @Remove methods?

If yes, when is this method invoked? At the time when a container pull the instance back to the pool or when a container remove the instance from the pool?

Correct me if my understanding is wrong.

regards,
Daniel
 
Senthil Kumar
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why do we need the remove methods after all?.To inform the container that we are done with that session object, so it can remove the object.This is for the stateful.
whereas in stateless session beans the container can delegate a clients call to any arbitary bean that picks up from the pool.It doent have to worry about the activation and passivation mechanism. And there is no memory to be released unlike Stateful.So we(the clients) dont have to call the remove methods.

hope this helps,
 
Shivani Chandna
Ranch Hand
Posts: 380
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Fisher Daniel:
Dear all,
As we know that some vendor of EJB container create a pool for EJB instances, is it possible that our stateless session beans have @Remove methods?


SSB = stateless session bean
SFSB = stateful session bean

Yes, it is possible for SSB to have @Remove methods but these methods serve no purpose as SSB is mainly Container managed as opposed to SFSB which is client managed. Infact the Sun App Server ignores the call of Removal for SSB.

@Remove method is not invoked by the container but by the client. It is entity callback @PreDestroy which is invoked by Container if
@Remove is successful. Client may invoke @Remove method to signal the Container to mark the instance for GC.
Any further invocation on the instance would give NoSuchEJBException.

Also,if the SFSB bean is already in a transaction then invoking the @Remove method would throw RemoveException.
[ June 20, 2007: Message edited by: Shivani Chandna ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic