JBossCache running in replication mode is an example of a service that ''s exposed via an mbean on each node.
If you want to use the singleton mbean approach, you can store your state in one of the replicated JBoss services (JBossCache, HA-JNDI or DistributedState). When you need to nominate a new master node, you can obtain the state from the service on that node and then dynamically register the associated mbean.
thanks for your answer.
The DistributedState indeed seems to fit my needs (presuming there is no AppServer-independent solution).
I already searched for more information on this, also read the Javadoc and Wiki, but have not been able so far to understand how to actually use it.
Maybe you have some doc or anything you could point me to.
If you require an app server independent solution, JBossCache can be used with other app servers. HA-JNDI and DistributedState have dependencies on JBossAS.
The JBossAS Clustering manual contains a brief description of DistributedState. See the index for its location. http://docs.jboss.org/jbossas/clustering/JBossClustering7.pdf
One place to look for sample code is in the testsuite. There's a test case for DistributedState in org.jboss.test.cluster.test.DistributedStateTestCase.