• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejbPassivate and ejbRemove for SFSB

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens when a user calls remove on a passivated session bean?
1) Container treats it as any other business method and calls ejbActivate and then ejbRemove.
2) Container will kill the bean without calling ejbActivate.
I personally think 1 is correct. But I wanted to confirm that.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, 2 is correct because it is pointless for the container to activate a stateful session bean and then destroy it. It will go straight from the "passivated" state to the "does not exist" state without ever getting an ejbRemove() call. As ejbRemove() may never be called, it makes sense to replicate your code (cleanup, finalization, etc) in both ejbPassivate() and ejbRemove().
It's also worth bearing in mind that ejbPassivate() may also never be called. This means that none of your cleanup code may ever get called, so you will need do your cleanup at intervals in case ejbPassivate() or ejbRemove() were never called.
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has been answered in detail by Kathy in the following post
https://coderanch.com/t/158446/java-EJB-SCBCD/certification/Some-questions
Thanks
 
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This has been answered in detail by Kathy in the following post
https://coderanch.com/t/158446/java-EJB-SCBCD/certification/Some-questions

I read the article posted by Kathy Siera as directed by Seema but I don't think that there is a direct answer to what Sany Bel has asked.
With respect to Sany's question is the answer option number 1 or 2? and also why?
Thanks,
Santosh
 
Seema Manivannan
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
Option 1 is correct.
Kathy says in the given post:
for stateFUL session beans, the container will treat a remove() method as a business method, and "wake up" the bean to invoke the ejbRemove() method (so ejbActivate() will be called first).
Thanks
[ April 09, 2004: Message edited by: seema manivannan ]
 
Sany Bel
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Seema!!
 
Santosh Ramachandrula
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Seema!!
I got it..

Santosh
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic