This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Websphere and the fly likes Static variable behavior in multi JVM env Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Static variable behavior in multi JVM env" Watch "Static variable behavior in multi JVM env" New topic
Author

Static variable behavior in multi JVM env

Gajanan Gawhale
Greenhorn

Joined: Jun 26, 2010
Posts: 3
Hi,

I have defined a Map as a static variable and using it is as a cache. But when this map is getting updated the updated value is seen only in the JVM where it is updated.
What needs to be done to update the map value available on all the JVMs present on multiple nodes on multiple cells?

Thank you,
Ari
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

You could use a distributed caching library. Or treat the static variable as a read only cache so you don't have to worry about updates.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Gajanan Gawhale
Greenhorn

Joined: Jun 26, 2010
Posts: 3
Jeanne Boyarsky wrote:You could use a distributed caching library. Or treat the static variable as a read only cache so you don't have to worry about updates.


Thanks for your quick reply. I need to update the cache as well so cannot make it read only. Is 'distributed caching library' available by default in WebSphere Server?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

WebSphere offers Command Caching and Dynacache for a distributed cache. It is not on by default. And you have to use specific APIs rather than simply a static Map.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Static variable behavior in multi JVM env