4 Replies Latest reply on Apr 6, 2006 7:56 AM by Thorbjørn Andersen

    Where/how is Ctrl-C shutdown handled?

    Marty Urbanek Newbie

      I am running the JBoss 2.4.4 + Tomcat 3.2.3 bundle on an IBM iSeries (AS/400) under V5R1 w/ JDK 1.3.1. The terminal and shell environment is different than you find on a PC or Unix.

      I can get JBoss to start up, serve me the example page on port 8080 and run the JSPs.

      My problem is the Shutdown. JBoss says press Ctrl-C to shutdown, but this doesn't seem to work in my environment. It terminates the application immediately without going through its shutdown process. IBM says they raise SIGINT, which should be exactly what Ctrl-C does on Unix. I believe the SIGINT is raised, becuase a message to that effect is produced (from IBM not from JBoss). However the shutdown is not perfomed. But is the JBoss code really waiting for a SIGINT or what?

      I do not know how to proceed. I tried to search the JBoss-all source for where the message "Press [Ctrl] + [C]" is generated, so I could write a smaller program to test the handling of this signal, but I cannot find that string anywhere. I am new to java, etc. Any advice appreciated.

      THANKS IN ADVANCE.

      -Marty

        • 1. Re: Where/how is Ctrl-C shutdown handled?
          Greg Turner Apprentice

          Not sure why this is happening. Search the forum, here, because I've seen this problem listed before.

          As to where some of the code is, in my copy of the source, there is a file org/jboss/Shutdown.java that shows how to shutdown from client side. There is also org/jboss/util/ShutdownMBean.java which looks to be the MBean that actually does the shutdown.

          • 2. Re: Where/how is Ctrl-C shutdown handled?
            Marty Urbanek Newbie

            Thank you for the reply. I did search before I posted, however I searched for AS/400. A search for "shutdown" yielded good info on how to shutdown from the browser or client (after they fix the code). That is very helpful.

            I am still looking for the piece of code that actually picks up the Ctrl-C. Can you provide any insight into this? I would like to determine why the OS/400 Qshell environment does not respond like others, but I will need to isolate the Ctrl-C handling portion of JBoss first. I see a lot of code about a "shutdown hook". I see a shutdown method where it logs the "Shutting down" message and that must be related to the one I am looking for. Where does the message "Press [Ctrl]+[C] to abort" come from?

            Thanks again.

            • 3. Re: Where/how is Ctrl-C shutdown handled?
              Adrian Brock Master

              Look at the javadocs for java.lang.Runtime.addShutdownHook

              The signal is handled by the VM and passed to this hook.
              I suspect your sysreq 2 is doing an abnormal end,
              QShell is a bit pants.

              Regards,
              Adrian

              • 4. Re: Where/how is Ctrl-C shutdown handled?
                Thorbjørn Andersen Newbie

                 

                "MartyU" wrote:

                My problem is the Shutdown. JBoss says press Ctrl-C to shutdown, but this

                -Marty


                You should use Shift-ESC 2 RET to tell a Java program to shut down.