diff options
author | Benoit Foucher <benoit@zeroc.com> | 2002-08-09 14:47:51 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2002-08-09 14:47:51 +0000 |
commit | 8774379a65a2f03c22bd57a9f601ca2d65921acf (patch) | |
tree | ed4e80924ed87bacc30e9140470735d5eee5ef78 /java/src/Ice/Application.java | |
parent | Added new IcePack test suite, add IcePack tracing properties, added IcePack (diff) | |
download | ice-8774379a65a2f03c22bd57a9f601ca2d65921acf.tar.bz2 ice-8774379a65a2f03c22bd57a9f601ca2d65921acf.tar.xz ice-8774379a65a2f03c22bd57a9f601ca2d65921acf.zip |
Added Ice application shutdown hook. Fixed IceBox to use Ice Application.
Added new IcePack deployer test suite.
Diffstat (limited to 'java/src/Ice/Application.java')
-rw-r--r-- | java/src/Ice/Application.java | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/java/src/Ice/Application.java b/java/src/Ice/Application.java index a39c250d589..6e57ccdf582 100644 --- a/java/src/Ice/Application.java +++ b/java/src/Ice/Application.java @@ -123,25 +123,49 @@ public abstract class Application return _communicator; } - // - // TODO: These need to be implemented. - // 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); } - + public static void ignoreInterrupt() { + try + { + Runtime.getRuntime().removeShutdownHook(_shutdownHook); + } + catch(java.lang.IllegalStateException ex) + { + // + // Expected if we are in the process of shutting down. + // + } } public static void defaultInterrupt() { + try + { + Runtime.getRuntime().removeShutdownHook(_shutdownHook); + } + catch(java.lang.IllegalStateException ex) + { + // + // Expected if we are in the process of shutting down. + // + } } - private static String _appName; private static Communicator _communicator; + private static Thread _shutdownHook; } |