The -Xrs argument reduces the use of OS signals by the JVM.
In normal mode (i.e. without -Xrs), operating system signals are used by the
JVM for various internal purposes. For example they are used to implement
shutdown hooks that are used to clean up in response to unexpected termination.
Signals may also be used by the JVM to optimize synchronization of all threads
in preparation for a full garbage collector sweep. They may also be used to
optimize branch execution in compiled native code.
However an application that embeds the JVM (e.g. a native application written
in C++) may need to install its own signal handlers. If the JVM also tried to
install these signal handlers then they would interfere with the ones installed by
the embedding application. In this case the -Xrs option should passed to the
When -Xrs is used, it can lead to a small decrease in performance because it
reduces the availability of some optimizations. It also means that thread dumps
can no longer be generated, e.g. by sending the SIGQUIT signal on UNIX or
by pressing Ctrl-Break in the console under Windows. Finally, the JVM will
not exit (and shutdown hooks will not execute) in response signals that would
normally cause it to exit.
The exact behaviour of -Xrs varies depending on the operating system:
• On UNIX and UNIX-like OSes such as Linux and MacOS, when -Xrs is
used the JVM does not alter the signal masks for SIGINT, SIGTERM,
SIGHUP or SIGQUIT, and signal handlers are not installed for these
• On Windows when -Xrs is used the JVM does not install a console control handler, therefore it does not process CTRL_C_EVENT,
CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT or CTRL_SHUTDOWN_EVENT.
Most pure Java applications should not use -Xrs. An exception is when the
application runs as a Windows Service, i.e. a continually running background
program that should not exit when the user logs off. By enabling -Xrs in this
scenario, the JVM does not process CTRL_LOGOFF_EVENT and therefore
continues running even when the user logs off.
-Xrs is off by default.
Arguments Related to -Xrs:
• IBM documentation regarding -Xrs.
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.
Edit your Comment