7193463: Improve registering signal handlers in java.lang.Terminator.setup()
authordingxmin
Thu, 23 Aug 2012 16:28:17 +0800
changeset 13584 6e57ea0f4563
parent 13583 dc0017b1a452
child 13585 4e446fa0c1c0
7193463: Improve registering signal handlers in java.lang.Terminator.setup() Reviewed-by: dholmes, alanb
jdk/src/solaris/classes/java/lang/Terminator.java
jdk/src/windows/classes/java/lang/Terminator.java
--- 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()
         }
     }