2 Replies Latest reply on Jun 1, 2004 3:25 AM by mattinvs

    Initialization tasks in a cluster?

    mattinvs

      Hello!

      Do you know of a way to initialize ressources (like an external scheduler or some initial database calls) in an application deployed in a cluster?

      My current approach (which fails for clustered deployment) was to have a startup servlet (deployed in a .war), which calls an initialization method in a stateless session bean (deployed in a -ejb.jar in the same .ear). But when deploying the ear to a cluster, the startup servlet is executed in each cluster (of course it is) and therefore the initialization tasks are triggered in both clusters. But they are not idempotent, so calling these initializations multiple times is wrong for my application.

      Any suggestions are welcome...

      Best regards and thanks,
      Mattin

        • 1. Re: Initialization tasks in a cluster?
          slbain

          Hi Mattin,

          There is a clustered provided. It is discussed in the clustering documentation. The <org.jboss.ha.singleton> package is another place to start looking. There are examples also.

          Hope this is of some help.
          sinclair

          • 2. Re: Initialization tasks in a cluster?
            mattinvs

            Hi,
            thanks for the hints, I had a look at them (was on vacation, so could not answer earlier ;-). They would proove more useful to me, if they would be J2EE-generic...
            I (although I did not mention it earlier) was searching for a solution, that would run on multiple J2EE servers. Currently our application needs to run on JBoss and BEA Weblogic, probably support for Websphere will be needed in future. Therefore I'll probably use the database for locking (although unlocking will be tough in case of a power blackout...). Maybe a combination of CMP and some sort of database lock will help here... Any hints on this?

            Best regards from Black Forrest, Germany,
            Mattin