Let’s say I have a Java webapp deployed on some Application Server with clustering across a few nodes.
In the webapp, we maintain a cache of some values retrieved from the database, stored in-memory as static variables. Whenever a user performs an update in a particular screen, we clear the cache so that the cached values will be retrieved again the next time they are needed.
Now the problem: Since each node in the cluster is running on a separate JVM, how can I clear the cache across all nodes? Basically I want to call a static function on each cluster node. Is there some standard J2EE way to do this, or it depends on the Application Server software?
On a ‘standard’ application server like Jboss you could use JMX or Message Beans for that.
If you enjoyed my content for some reason, I'd love to hear from you! Here are some options:
- You can buy me a coffee!
- You can write a reply on your own site and submit the URL as a webmention via the form below.
- Or you can just contact me!