• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ejbRemove In Session Bean

 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Folks,
I have a doubt on Stateful Session Beans.
Consider this situation.

Say suppose that a Stateful Session Bean is in Passivated State.
Now when the Client calls remove on the EJB Object stub, will the container execute ejbRemove() (i.e. the bean will come back to "Method Ready" state and then code in ejbRemove() will be executed) or directly send the Bean to "Does Not Exist" state?

Cheers,
Sandeep
 
Salil Surendran
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a bean is in a passivated state then the bean has to brought out of the passivated state and it's ejbRemove has to be called. As per the spec the following scenarios result in ejbRemove not being called on an instance:
� A crash of the EJB container.
� A system exception thrown from the instance�s method to the container.
� A timeout of client inactivity while the instance is in the passive state.
 
Sandeep Prabhakar
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Salil,
My question is does calling "remove" while the bean is in Passivated state, bring back the bean to "Method Ready" state???
 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Section 7.6.3 of the spec (page 82) for SFSB says the following:
The following scenarios result in ejbRemove() not being called on an
instance:
� A crash of the EJB Container.
� A system exception thrown from the instance�s method to the Container.
� A timeout of client inactivity while the instance is in the passive state. The timeout is specified
by the Deployer in an EJB Container implementation specific way.


Since spec mentions only these scenarios, I would assume that, when client calls the remove method explicitly, it should get the bean back to method ready state. But, I also did not notice this action - "bringing the bean from passivated to method ready for calling ejbRemove" - as mandatory action anywhere. Hence I would assume it would depend more on the container implementation.

In short - according to the scenarios given in the spec, ideally the bean should transition from passive to method ready, but as spec doesn't mandate this transition, it will depend on container implementation.

Ranchers, please correct me if I am wrong.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic