2 Replies Latest reply on Mar 3, 2004 10:52 AM by kaobe

    How to use SingletonController (Clustering Doku Chapter 11)?

    kaobe

      Hi out there!!

      I have read the above mentioned part of the clustering docu several times, but I still don't know how to use it.
      But first I will explain what I'm planning to do:
      I have a clustered jboss here with 2 or more cluster nodes on the partition.
      There are several functions in my beans that need to be executed by a singleton - that means they may only be executed once in the whole cluster and they create or change data that must be unique. So I thought it would be good to use the DistributedState Service and the Singleton Service. I hope my assumption is right so far.
      So I tried to create a stateless session bean that calls a mbean that I created. And this mbean is the target of the HASingletonController. It has the start and stop method and becomes started only on the master node. So far everything is fine.
      But how do I address the Singleton on the master node? So far the actions my singleton executes takes place on whatever machine the stateless session bean has been called.
      Can anybody explain how to do the thing I want or could anyone perhaps give me some code that shows me how to do this? Or am I missing some essential things here?

      Thank you all for your help!

      Peter

      PS: I'm on the JBoss Advanced training next week in Frankfurt. Will this topic be part of the training?

        • 1. Re: How to use SingletonController (Clustering Doku Chapter
          ivelin.ivanov

          Peter,

          you need to explain a bit more.
          Why is the session bean calling the mbean, which in tern calls the singleton?

          It's supposed to be the other way around. The singleton is automatically started and stopped on the master node.

          Explain a bit more about what needs to happen from a functionality perspective.

          Ivelin

          • 2. Re: How to use SingletonController (Clustering Doku Chapter
            kaobe

            Hi Ivelin,

            Until now the application is hosted by a standalone JBoss. In this instance I have a singleton that can read and write data that may only occur once in the server.
            Now I'm migrating the application to a JBoss cluster. So I wanted to let this clusterwide unique data be handled by the singleton service. I have taken the example from your article and have extended it so it writes to the DistributedState Service.
            Now I have the problem that I have no possibility to get the instance to the current master node to get a reference to the master singleton. I need this reference because I thought, only the singleton instance on the master node may change the data.
            I have talked to Peter Diesler now at the advanced training in Frankfurt, and he told me that I didn't have to worry about the singleton instance of the master node because the service would take responsibility that the data it writes is unique. But then I don't understand what the singleton service does exactly.
            Could you please explain me how I can use the SingletonService from your article to hold clusterwide unique data in the applicationserver? I think that could clarify a lot.
            Thank you very much so far!

            Peter