Reduces use of operating-system signals by the Java virtual machine (JVM).
In a previous release, the Shutdown Hooks facility was added to allow orderly shutdown of a Java application. The intent was to allow user cleanup code (such as closing database
connections) to run at shutdown, even if the JVM terminates abruptly.
Sun's JVM catches signals to implement shutdown hooks for abnormal JVM termination. The JVM uses SIGHUP, SIGINT, and SIGTERM to initiate the running of shutdown hooks.
The JVM uses a similar mechanism to implement the pre-1.2 feature of dumping thread stacks for debugging purposes. Sun's JVM uses SIGQUIT to perform thread dumps.
Applications embedding the JVM frequently need to trap signals like SIGINT or SIGTERM, which can lead to interference with the JVM's own signal handlers. The -Xrs
command-line option is available to address this issue. When -Xrs is used on Sun's JVM, the signal masks for SIGINT, SIGTERM, SIGHUP, and SIGQUIT are not changed by the
JVM, and signal handlers for these signals are not installed.
There are two consequences of specifying -Xrs:
* SIGQUIT thread dumps are not available.
* User code is responsible for causing shutdown hooks to run, for example by calling System.exit() when the JVM is to be terminated.