Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

calling remove() on passivated SSBean

 
Vaithiya Sundaram
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Sujatha Kumar
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Paul J Smith
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Girija Siva
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Vaithiya Sundaram
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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???
 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's been already discussed at this thread. You will find the answer that Kathy has given.
http://www.coderanch.com/t/159135/java-EJB-SCBCD/certification/ejbPassivate-ejbRemove-SFSB
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic