• 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

when should Handle or EJBHome been cached?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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().

What are the pros and cons for these 2 approach?

Thanks,
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
M Zhang
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Devender Thareja
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic