7193463: Improve registering signal handlers in java.lang.Terminator.setup()
Reviewed-by: dholmes, alanb
--- a/jdk/src/solaris/classes/java/lang/Terminator.java Tue Aug 21 11:00:30 2012 -0700
+++ b/jdk/src/solaris/classes/java/lang/Terminator.java Thu Aug 23 16:28:17 2012 +0800
@@ -53,14 +53,20 @@
}
};
handler = sh;
+ // When -Xrs is specified the user is responsible for
+ // ensuring that shutdown hooks are run by calling
+ // System.exit()
try {
Signal.handle(new Signal("HUP"), sh);
+ } catch (IllegalArgumentException e) {
+ }
+ try {
Signal.handle(new Signal("INT"), sh);
+ } catch (IllegalArgumentException e) {
+ }
+ try {
Signal.handle(new Signal("TERM"), sh);
} catch (IllegalArgumentException e) {
- // When -Xrs is specified the user is responsible for
- // ensuring that shutdown hooks are run by calling
- // System.exit()
}
}
--- a/jdk/src/windows/classes/java/lang/Terminator.java Tue Aug 21 11:00:30 2012 -0700
+++ b/jdk/src/windows/classes/java/lang/Terminator.java Thu Aug 23 16:28:17 2012 +0800
@@ -53,13 +53,17 @@
}
};
handler = sh;
+
+ // When -Xrs is specified the user is responsible for
+ // ensuring that shutdown hooks are run by calling
+ // System.exit()
try {
Signal.handle(new Signal("INT"), sh);
+ } catch (IllegalArgumentException e) {
+ }
+ try {
Signal.handle(new Signal("TERM"), sh);
} catch (IllegalArgumentException e) {
- // When -Xrs is specified the user is responsible for
- // ensuring that shutdown hooks are run by calling
- // System.exit()
}
}