6 Replies Latest reply on Jan 22, 2006 6:42 AM by Dimitris Andreadis

    The

    Jimmy Wilson Apprentice

      The org.jboss.system.server.stopped notification appears to only be emitted if ServerImpl.halt/halt(exitcode) is called.

      Given that server shutdown can be precipitated by the shutdown and exit methods on the same class in addition to a signal sent by Ctrl+C and/or kill depending on your platform, could a sentStopNotification method be added to contain this behavior and to be called by the JBoss Shutdown Hook defined in that same Java file? This seems like it would ensure that the notification was sent regardless of the shutdown method used.

      Is there a reason that the halt methods are the only ones to emit this notfication that I may have missed?

        • 1. Re: The
          Dimitris Andreadis Master

          I think I've fixed this in 4.0.3SP1:

          JBAS-2483, allow jboss to restart with an exit(10).
          Improve logged messages to trace the shutdown execution path,
          move shutdown notification to the shutdown hook
          (avoid duplicate notifications/don't notify when halting), retain the
          exit code when jboss.shutdown.forceHalt is enabled, disable forceHalt
          by default (it would possibly kill other concurrent shutdown hooks).

          So the notification should be send in all cases, except halting (that kills the JVM instantly)

          • 2. Re: The
            Jimmy Wilson Apprentice

            The subject did not print correctly...

            I know we have tried this with JBoss 4.0.3 (and had the same results), but I am not sure if that was SP1 or not. I will verify this...

            • 3. Re: The
              Jimmy Wilson Apprentice

               

              "jiwils" wrote:
              I know we have tried this with JBoss 4.0.3 (and had the same results), but I am not sure if that was SP1 or not. I will verify this...

              Okay, I have the same problem in 4.0.3sp1, but its because I am not using the MBean methods to shutdown (in all cases). I am using both Ctrl+C and kill, so while your fixes add the notification to more than one method, it still will not get sent in then.

              Is there any way we could have the shutdown hook send the notification? Then, it could be coded in one place (not the three methods), and I'll be sure it get it in the Ctrl+C and kill cases too.

              • 4. Re: The
                Jimmy Wilson Apprentice

                 

                "jiwils" wrote:
                Is there any way we could have the shutdown hook send the notification? Then, it could be coded in one place (not the three methods), and I'll be sure it get it in the Ctrl+C and kill cases too.


                In looking at the Runtime.halt method Javadoc, it does look like it might be necessary to send the notification from multiple places as halt does not invoke the Shutdown Hooks...

                So, I guess my question is whether or not we might could add this notification to the JBoss Shutdown Hook as well? In all but the Runtime.halt cases, it would take care it.

                • 5. Re: The
                  Jimmy Wilson Apprentice

                  I went ahead and created a JIRA issue.

                  http://jira.jboss.com/jira/browse/JBAS-2697

                  • 6. Re: The
                    Dimitris Andreadis Master

                    I was actually wrong; this is fixed *after* 4.03SP1, so it'll come with 4.0.4RC1. I actually tested it and I can see the notification, with CTRL-C pressed.

                    An easy way to tests this is by including this service (e.g. in deploy/monitoring-service.xml):

                     <mbean code="org.jboss.monitor.services.NotificationListener"
                     name="jboss.jmx:service=NotificationListener">
                     <attribute name="SubscriptionList">
                     <subscription-list>
                     <mbean name="jboss.system:type=Server"/>
                     </subscription-list>
                     </attribute>
                     </mbean>
                    


                    So I'm going to close the case, sorry for the confusion.