changeset 5397:dc357f9feaa2

7193463: Improve registering signal handlers in java.lang.Terminator.setup() Reviewed-by: dholmes, alanb
author dingxmin
date Thu, 23 Aug 2012 16:28:17 +0800
parents e20b5961ca5b
children 979c364ea1f1
files src/solaris/classes/java/lang/Terminator.java src/windows/classes/java/lang/Terminator.java
diffstat 2 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/solaris/classes/java/lang/Terminator.java	Thu Sep 15 19:29:07 2011 +0100
+++ b/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/src/windows/classes/java/lang/Terminator.java	Thu Sep 15 19:29:07 2011 +0100
+++ b/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()
         }
     }