1 Reply Latest reply on Jul 23, 2007 4:51 AM by Mirko Steinicke

    :: Singleton Object in clustered Environment ::

    BhaktavatsalamReddy Newbie


      I'm writing a singleton class which would be used in a web application in the cluster environment. Does somebody know what is the behavior of a singleton object in a cluster environment?

      I think there could be 2 possible behaviors:

      1)The singleton object is kept in all the server instances.
      2)The singleton object is kept only in the server it was created.

      If somebody knows the answer or has some address, I would appreciate it.


        • 1. Re: :: Singleton Object in clustered Environment ::
          Mirko Steinicke Newbie

          Therefore you could use a HASingleton. This singleton only runs on one node but is deployed on all other nodes via the deploy-hasingleton directory in order to provide failing over in case of a crash of the singleton-running server.

          note that if you just implement a common singleton you should experience that this one will run on all of the cluster nodes as its deployed on all nodes via the deploy directory. could be possible that this is not a problem in your case but i wouldn't expect it to be.

          i just experienced on my own ;)