Improve registering signal handlers in java.lang.Terminator.setup()
Frank Ding
dingxmin at linux.vnet.ibm.com
Fri Aug 3 07:39:53 UTC 2012
Hi guys,
I found that in java.lang.Terminator, setup() method,
The following code of registering default signal handlers can be improved:
/ try {
Signal.handle(new Signal("INT"), sh);
Signal.handle(new Signal("TERM"), sh);
} catch (IllegalArgumentException e) {
}/
The revised code is illustrated below:
/ try {
Signal.handle(new Signal("INT"), sh);
} catch (IllegalArgumentException e) {
}
try {
Signal.handle(new Signal("TERM"), sh);
} catch (IllegalArgumentException e) {
}
/The improved version makes more sense since exception thrown from first
Signal.handle call does not affect subsequent calls. This is more
consistent with its original intention.
A patch I made is available @
http://cr.openjdk.java.net/~youdwei/ojdk-430/webrev.00//
/Could anybody please take a look at it? Thanks in advance/
Best regards,
Frank
/
More information about the core-libs-dev
mailing list