RFR 9: 8087286 Need a way to handle control-C and possibly some other signals

David Holmes david.holmes at oracle.com
Sat Feb 6 00:54:47 UTC 2016

On 5/02/2016 2:24 PM, Mandy Chung wrote:
>> On Feb 4, 2016, at 5:05 PM, David Holmes <david.holmes at oracle.com> wrote:
>> Java hasn't needed a public signal handling API for the last 20 years. It's only getting one now because modularity is forcing us to cut-off sun.misc.Signal from the few use-cases that do need it. And we now have a "shell" mechanism that also wants to do some process management. This is fundamentally about ctrl-C and ctrl-\ hooks because the native shells turn those into signals.
> As a data point, the primary use case I gathered and reported by some customers using sun.misc.Signal is the ability to intercept control-C.  SIGTERM, SIGKILL, SIGTRAP are also intercepted in addition to SIGINT [1]

Note the signals SIGKILL and SIGSTOP cannot be caught or ignored. We are 
really talking about a very few specific, primarily process-management 
related, signals. Plus the general-purpose SIGUSR1, SIGUSR2.

Regardless of whether I agree with this API or not, it does, as Stuart 
points out, require a JEP and to go through the normal rigorous process 
of determining whether an API is suitable for inclusion in the Java 


> Mandy
> [1] http://mail.openjdk.java.net/pipermail/jigsaw-dev/2015-June/004362.html

More information about the hotspot-runtime-dev mailing list