6 Replies Latest reply on Apr 16, 2008 5:28 PM by mattias1

    Start / stop of application

    mattias1

      Hi,

      Hoping to post under the correct forum. I have two questions regarding applications deployed as ear-files.

      1) How can I programatically stop (shutdown) an application?
      2) How can I "overload" the startup behaviour of my application.

      What I'm trying to do, is to during application startup, I will poll a license server. If license is OK, continue. Otherwise shut down the application.

      I have not been able to find this in the documentation.

      Thanks,
      Mattias

        • 1. Re: Start / stop of application

          Hi Mattias,

          You could try invoking operations of the MainDeployer MBean (jboss.system:service=MainDeployer) using JMX. This Mbean exposes operations to list all the applications deployed as well as to start/stop applications.

          Clive

          • 2. Re: Start / stop of application
            mattias1

            Hi Clive,

            Thanks! I guess I can list all deployed applications with the listDeployed() method. However I cannot find any method to stop an application. There is the undeploy(DeploymentInfo) method, but I cannot find any method to just stop a specific application...

            BR,
            Mattias

            • 3. Re: Start / stop of application

              Could you clear one thing for me. By stop application do you mean shutdown the application? Because undeploying it would actually shut it down ... right?

              Clive

              • 4. Re: Start / stop of application
                mattias1

                Yes, with stop I mean shutting down the application, without undeploying it.

                /Mattias

                • 5. Re: Start / stop of application

                  Just a suggestion ... how about making an MBean to manage you application (start/stop). The polling of the licence servers could be moved to this MBean rather than in the application.

                  Clive

                  • 6. Re: Start / stop of application
                    mattias1

                    Yes, that is what I'm thinking about. But I do not know how to make the stop of the application from the MBean...

                    Lets say I have an MBean that schedules a task to poll the license server every hour, for example. When it discoveres that the license have expired, how can it stop (shutdown) the application?

                    /Mattias