• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

ejbRemove for a session bean

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The EJB2.0 Specs mentions that "A timeout of client inactivity while the instance is in the passive state will result in the ejbRemove() method not being called". So what if the bean times out while it is in the method ready state ? Will ejbRemove() method be called then ? Is this mentioned in the specs any where ?
Thank you
Deepti
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In such a case the conatiner may call the ejbPassivate() method on the bean.
 
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In EJB Spec2.0 See 7.6 Stateful Session bean state Diagram

I will it help you.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Deepti Sabarinath:
The EJB2.0 Specs mentions that "A timeout of client inactivity while the instance is in the passive state will result in the ejbRemove() method not being called". So what if the bean times out while it is in the method ready state ? Will ejbRemove() method be called then ? Is this mentioned in the specs any where ?
Thank you
Deepti


Howdy
[yes, I'm once again alive and online after a loooong break finishing the book]
If the bean times out while method-ready, yes, the Container calls ejbRemove() to give the bean a chance, just as if the client had invoked remove() on the bean's component interface (or remove(handle) on the bean's remote home interface).
It's in the spec... don't have it in front of me to give you the actual page, but if you look in the session bean chapter, you'll find the lifecycle diagrams, and they show that you can have several paths to the "does not exist" state:
1) Client calls remove() on a stateful bean that's in the method-ready state, OR the bean times out while in the method-ready state, in which case Container calls ejbRemove() and then kills the bean
2) Client calls remove() on a stateful bean that's been passivated, OR the bean times out while passivated, in which case Container does NOT call ejbRemove(), but simply kills the bean
3) Bean throws a system exception (which for the bean, means any runtime exception including an EJBException) in which case, the Container logs the exception and kills the bean WITHOUT calling ejbRemove().
The exam indeed expects you to know the following ways in which a bean could MISS getting ejbRemove():
1) Container crashes
2) Bean times out while passivated
3) Bean throws a system exception
Hope that helps
p.s. The book has started to ship! I just got a copy from the publisher, so I've now held it in my hands. Amazon customers will be getting it first, and O'Reilly thinks that the Amazon pre-orders will go out within the next several days. It will not appear in stores for another week or two. The books are in the process of moving through warehouses and distribution channels.
Whew! Now I can finally go back to having fun and hanging out at the ranch.
cheers,
Kathy
 
permaculture is largely about replacing oil with people. And one tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic