Win a copy of Pipeline as Code this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

calling remove() on passivated SSBean

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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???
 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's been already discussed at this thread. You will find the answer that Kathy has given.
https://coderanch.com/t/159135/java-EJB-SCBCD/certification/ejbPassivate-ejbRemove-SFSB
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic