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

getEJBObject from ejbPassivate,ejbActivate

 
Nauman Khan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • 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,
 
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic