2 Replies Latest reply on May 28, 2004 12:08 PM by timdrisdelle

    How to implement get/setDistributedState?

    timdrisdelle

      I've got a singleton mbean (extends HASingletonSupport), and I want to have some runtime-configurable parameters be shared across the cluster.

      If a parameter is changed on one of the nodes, I want it to be reflected across all of the nodes (...which is why I'm using singleton!).

      I read the Clustering doc, but I still can't figure out how I'm supposed to implement the getDistributedState and setDistributedState methods in my mbean.

      should I still have a private member variable in the mbean, with a getter and setter?

      or should there be no private member variable, and the getter/setter call the get/setDistributedState methods?

      And how should the get/setDistributedState methods work with the start/stopSingleton methods?

      Vexed in Victoria,
      Tim.

        • 1. Re: How to implement get/setDistributedState?
          slaboure

          I would instead use the DistributedState service: no need to implement anything, just use it as is, very convenient to share configuration accross a cluster.

          cheers,

          sacha

          • 2. Re: How to implement get/setDistributedState?
            timdrisdelle

            My mbean extends HASingletonSupport, which extends HAServiceMBeanSupport.

            The HAServiceMBeanSupport class has two "convenience" methods called getDistributedState and setDistributedState, which both delegate to the DistributedStateService.

            Therefore, I should be able to call getDistributedState and setDistributedState from within my mbean.

            My question is really, how and when do I make these calls? Do I still need individual getters and setters for my runtime configuration properties, each of which will call get/setDistributedState?

            Tim