Singletons have the capability to share state across the cluster. It does not happen automatically, but you can enable it. The most straightworward way is to extend HASingletonSupport. Then implement startSingleton/stopSingleton. For the attributes that are supposed to be shared across the cluster use setDistributedState/getDistributedState instead of local member variables.
Thanx for the answer Ivelin.
I did some search on this, & it seems its a relatively new addition.
Read your article available at http://www.onjava.com/pub/a/onjava/2003/08/20/jboss_clustering.html on o'reilly and that clears certain things. But I have more questions.
The example in this article talks about singleton services implemented as MBeans. I have a singleton which is a very simple class .... no frills attached, and certain objects get added/deleted from it, which are contained in the singleton in a hashmap.
From the article I could not gather if it is neccesary to create an MBean for the purpose? but then the article was not talking about the support class u mentioned in ur post. Can u direct me to some article which outlines this basic usage cuz I can't find it (or is it only available in the paid docs :D)? Or let me know if the MBean use is mandatory?
Thanx in advance
Tou can use the Distributed State Manager facility directly outside of an MBean. It is described in the JBoss Clustering book.
Can anybody tell me where can i find the api for the class HASingletonSupport?