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

getEJBObject from ejbPassivate,ejbActivate

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have some little confusion to understand this that both ejbPassivate() and ejbActivate() have the reference of EJBObject because since ejbPassivate() is called bean instance goes from ready to pool state and in this method,bean releases the resources so it makes sense to have EJBObject identity once this method complete,bean instance is no more associated with any object identity but as the client request come, container activate the bean instance from pool to ready state and during this call the ejbActivate method runs. but since ejbActivate() completes then bean instance should have associated with the particular EJBObject identity and during ejbActivate is called bean instance should not be associated with EJBObject identity but it's not happening.
As spec says ejbActivate has the reference of EJBObject so that means container call some other method prior to the ejbActivate to make the link between bean instance and EJBObject or not?
Please put some light on it.
Regards,
 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes you are right. ejbActivate comes AFTER container de-serialized stateful session bean and ejbPassivate comes BEFORE container serialized that bean to persistent storage. This is what container promises you.
With entity beans it says the bean is going to the "pooled" and then going to "ready" state. But it does not say what happens with EJBObject right? Because you don't know what really EJBObject is (you have only provided component interface while container did all it's implementation). This is container specific. However you should act so if that bean is always associated with the same EJBObject. Passivation does not break this link.
 
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just an idea came to my mind... If passivation in the entity bean would break ejbobject-bean relationship... We would have to obtain new reference to remote component interface after each business method call probably
 
Nauman Khan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vladas,
Thanks to your reply, I'm not sure about new reference but passivation disassociates the instance with the ejbobject identity as spec says.But there is one more thing as you said,


However you should act so if that bean is always associated with the same EJBObject. Passivation does not break this link.


The particular EJBOjbect never die,it remains in the container and recieve the call from the client and container performs the job to pull the bean from the pool and associate with EJBObject prior to invoke ejbActivate method,so what container does to link,which is actually hidden and not visible and container specific You are right.
Regards,
 
Paper beats rock. Scissors beats tiny ad.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic