3 Replies Latest reply on Feb 16, 2002 7:04 PM by Darryl Thompson

    Using JMX to start and stop services

    Ivan Stojic Newbie


      I am trying to write my own JBoss 3.0 MBean services and I have a question I would like to ask.

      For example, I have a service A which uses (depends on) service B. So, MBean A has a mbean-ref to MBean B. When I undeploy service B (by deleting its .sar from the deploy dir) service A gets stopped (suspended) before that and that works great.

      Anyway, I would like the ability to start and stop service B using JMX. However, if I call the stop method of MBean B directly, only service B stops and service A keeps running (causing errors because B is no longer working).

      My question is: is there some way for the ServiceController to intercept the JMX invocation of the MBean B's stop method so that it can first stop all MBeans depending on service B? Or should I only start/stop services using start/stop methods of the ServiceController MBean giving it the ObjectName of my MBean?