Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Service Locator

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
if i understeand it good, the service locator caches the EJBHome-Obejct.
I was wondering, why not cache the EJB-Object, instead of the EJBHome-Object?
Greetings,
Roul
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to EJB forum...
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Roul,
EJB Object refers to the Bean object on the server side so its pooled or cached by the server already to enhance performance. Why to cache it again on client side where we are using service locator?
Also, if we cache EJBObject then server's pooling etc would be meaningless and it would like client is managing EJBObject which is against the J2EE architecture right?
I hope I make sense..
Others please provide more insights here...
Regards
Maulin
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Caching EJB objects doesn't help you very much. Usually you have to use several objects of the same type and instead of caching let's say 10 EmployeeBean bean objects,you cache only the EmployeeHome object and through this you can create/find/delete any number of EJBObjects.
The EJBHome object is used as a factory for EJBObjects and by caching it you don't have to look it up every time you want to manipulate an object it is responsable of.
You could read the EJBHomeFactory pattern (you can find it in Floyd Marinescu's EJB Desing Patterns) and after that you'll see the benefits of caching the EJBHome objects.
 
reply
    Bookmark Topic Watch Topic
  • New Topic