If a client calls remove() on stateful session bean, but the bean is in passivated state, what will happend? Whether the container will destroy that bean in the passivated state itself or it will bring to activated state then destroy it or it will destroy only EJBObject or something else?
Hi Vaithiya, When a Stateful Session Bean goes to a passivated state, only the bean instance information is stored in a secondary storage. The EjbObject associated with the client will still be active. So when a remove method is invoked the EJBObject and Bean instance information in the secondary storage will be deleted. I feel that the bean instance should not activated again. This is my assumption. Any one else could share their comments on this topic.
Gotta disagree. The only way a stateful session bean can be removed: 1) Call ejbRemove 2) Timeout 3) system crash The bean can only call ejbRemove on a 'method ready' bean. The container will therefore call ejbActivate() and then ejbRemove() to perform the request. P
I Agree with Paul on this. When the bean is in passivate state client can't make method calls on it. Either Activate is called or the bean will timeout. Calling remove() will activate the bean first and then ejbRemove() will be called leaving the bean in state does not exists
Thanks for your reply friends. I also thought in the way Paul mentioned about it. i.e. The container will call ejbActivate() and then ejbRemove() to perform the request.
But let us take timeout scenerio while the bean is in passivated state. In this case the container will not call ejbActivate() and ejbRemove() to send bean into does not exit state. The reason is mentioned in a book(HFE) that just to remove the bean from passivated state to does not exit state it is no need to be activated. In this way my question also follows the same scenerio. Just to remove the bean from passivated state it needs to be really activated??? If it should be activated then for the timeout case also it should be activated, right???