JVM Signal Handling on NT and HP-Unix
Hi
I'm trying to catch various JVM shutdown signals in my application so that the application can do some clean-up before shutting down. Here is the code that i've written...
sun.misc.SignalHandler jvmSignalHandler = new sun.misc.SignalHandler()
{
public void handle(sun.misc.Signal sig)
{
// Do some cleanup
}
};
// Call handler on interrupt signal (CTRL-C)
sun.misc.Signal.handle(new sun.misc.Signal("INT"), jvmSignalHandler);
// Call handler on terminate signal
sun.misc.Signal.handle(new sun.misc.Signal("TERM"), jvmSignalHandler);
// Call handler on abort signal
sun.misc.Signal.handle(new sun.misc.Signal("ABRT"), jvmSignalHandler);
If i run this process on NT in a dos box, the applicatin behaves fine by responding to all these signals...
e.g. If i press CTRL-C (INT), or i close the dos box (TERM), or i shutdown NT (ABRT).
However on UP-Unix, i tried kill -2 (TERM), kill -6 (ABRT) and kill -15 (INT)... Out of these, only kill -6 (ABRT) works, while the others just "kill" the application and there is no clean-up. Can anyone help if i need to use any other codes on HP-Unix, or do i need to catch any other signals in my application.
Thanks in advance
Regards
Kashif

