• 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
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

caching local objects

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am caching ejb local objects (stateless session beans)in the service locator in the class level static hashmap variable.

So I have a hashmap(cache of local objects) in one JVM
Will there be any impact of this caching in clustered environment?

I believe that in each server in the cluster there would be a hashmap(cache of local objects).This means that I will have same local object cached in different JVM hashmap.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Raj Joe:
This means that I will have same local object cached in different JVM hashmap.

No. Since you are caching references to local EJBs -- meaning they are in the same JVM -- each JVM cache will reference a different set of local EJBs (those in its JVM).
 
Raj Joe
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David Harkness:
No. Since you are caching references to local EJBs -- meaning they are in the same JVM -- each JVM cache will reference a different set of local EJBs (those in its JVM).



I am using a singleton (service locator).I am using an hashmap as static class variable to cache all remote/local objects.

In clustered environment I will end up having one service locator per JVM.
Even the static hashmap which hold references will be one per JVM.

My concern is even though a reference may be available in one JVM cache,because of clustering the request may go to other JVM and create a new reference in cache in that JVM.

Is there any impact of caching remote/local references in this way wrt to clustered environment

[ October 27, 2004: Message edited by: Raj Joe ]
[ October 27, 2004: Message edited by: Raj Joe ]
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As long as you are caching EJBLocalHome / RemoteHome reference you should be fine. Actual implementation of Home interface is implemented as single ton by most of the app servers. Each JVM will maintain reference to EJB<Local/Remote>Home Ojbect available on that box.
Clustering should not matter.

I hope you are trying to store reference to EJBLocalObject / EJBObject. Won't make sense to do so.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic