diff options
author | Marc Laukien <marc@zeroc.com> | 2002-09-02 15:25:35 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-09-02 15:25:35 +0000 |
commit | d99431205bc8c179b7cd52d4934818cddb29290c (patch) | |
tree | f7327563eedf2f86ca5ac37b0487d6dfc93f2bae /java/src/Ice/Application.java | |
parent | more IcePatch work (diff) | |
download | ice-d99431205bc8c179b7cd52d4934818cddb29290c.tar.bz2 ice-d99431205bc8c179b7cd52d4934818cddb29290c.tar.xz ice-d99431205bc8c179b7cd52d4934818cddb29290c.zip |
fixes
Diffstat (limited to 'java/src/Ice/Application.java')
-rw-r--r-- | java/src/Ice/Application.java | 65 |
1 files changed, 27 insertions, 38 deletions
diff --git a/java/src/Ice/Application.java b/java/src/Ice/Application.java index eb485f9e34e..faa1c836b7c 100644 --- a/java/src/Ice/Application.java +++ b/java/src/Ice/Application.java @@ -126,55 +126,44 @@ public abstract class Application synchronized public static void shutdownOnInterrupt() { - // - // As soon as the shutdown hook ends all the threads are - // terminated. So the shutdown hook will join the current - // thread before to end. - // - _shutdownHook = new ShutdownHook(Thread.currentThread()); - Runtime.getRuntime().addShutdownHook(_shutdownHook); - } - - synchronized public static void - ignoreInterrupt() - { - try - { - Runtime.getRuntime().removeShutdownHook(_shutdownHook); - } - catch(java.lang.IllegalStateException ex) + if(_shutdownHook == null) { // - // Expected if we are in the process of shutting down. + // As soon as the shutdown hook ends all the threads are + // terminated. So the shutdown hook will join the current + // thread before to end. // + _shutdownHook = new ShutdownHook(Thread.currentThread()); + Runtime.getRuntime().addShutdownHook(_shutdownHook); } } - + synchronized public static void - defaultInterrupt() + ignoreInterrupt() { - try - { - Runtime.getRuntime().removeShutdownHook(_shutdownHook); - } - catch(java.lang.IllegalStateException ex) - { - // - // Expected if we are in the process of shutting down. - // - } + // + // We cannot ignore, only set back to default. + // + defaultInterrupt(); } - synchronized public static boolean - isShutdownFromInterrupt() + synchronized public static void + defaultInterrupt() { - if(_shutdownHook == null) - { - return false; - } - else + if(_shutdownHook != null) { - return _shutdownHook.isShutdownFromInterrupt(); + try + { + Runtime.getRuntime().removeShutdownHook(_shutdownHook); + } + catch(java.lang.IllegalStateException ex) + { + // + // Expected if we are in the process of shutting down. + // + } + + _shutdownHook = null; } } |