I have a question to access stateful session bean: In my service locator, I can either cache the EJBHome or Handle for EJBObject. So when the client wants to access the session bean, it can call the delegate and the call the service locator to either getHandle.getEJBObject(), or getRemoteHome.create().
I would assume that the your service locater class is a singleton. Since it returns stateful session beans which are different for all clients you should be using getRemoteHome.create(). getHandle.getEjbObject would be inappropriate because service locater class has no knowledge about state of the bean. Right?
Thank you, Devender. I understand that the first time I need to call EJBHome.create to get the EJBObject. But after the first time, will that be more efficient if I can cache the EJBHandle of EJBObject, therefore, the client can find its stateful session bean faster?
This may be out of the scope of SCEA exam but I am curious to know.
I would keep the service locater simple. The client should cache it to improve performance and should reuse cached object whenever appropriate.
Originally posted by M Zhang: I understand that the first time I need to call EJBHome.create to get the EJBObject. But after the first time, will that be more efficient if I can cache the EJBHandle of EJBObject, therefore, the client can find its stateful session bean faster?
Devender Thareja
SCEA, SCBCD, SCJP
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, the permaculture playing cards