* Shutdown:

- Cancel our JVM shutdown hook when shutting down
    - Run a spinner task so shutdown always completes
    - exit() instead of halt() so other JVM shutdown hooks run
    - Prevent duplicate wrapper notifier hooks
    - Notify the wrapper twice, once for stopping and once for stopped
This commit is contained in:
zzz
2011-07-15 01:13:35 +00:00
parent 857f0a0448
commit 0bf0715adc
7 changed files with 184 additions and 40 deletions

View File

@@ -31,7 +31,7 @@ public class ConfigRestartBean {
// Normal browsers send value, IE sends button label
if ("shutdownImmediate".equals(action) || _("Shutdown immediately", ctx).equals(action)) {
if (ctx.hasWrapper())
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD));
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_HARD, false);
//ctx.router().shutdown(Router.EXIT_HARD); // never returns
ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond
} else if ("cancelShutdown".equals(action) || _("Cancel shutdown", ctx).equals(action) ||
@@ -39,16 +39,16 @@ public class ConfigRestartBean {
ctx.router().cancelGracefulShutdown();
} else if ("restartImmediate".equals(action) || _("Restart immediately", ctx).equals(action)) {
if (ctx.hasWrapper())
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_HARD_RESTART));
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_HARD_RESTART, false);
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond
} else if ("restart".equals(action) || _("Restart", ctx).equals(action)) {
if (ctx.hasWrapper())
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL_RESTART));
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_GRACEFUL_RESTART, false);
ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
} else if ("shutdown".equals(action) || _("Shutdown", ctx).equals(action)) {
if (ctx.hasWrapper())
ctx.addShutdownTask(new ConfigServiceHandler.UpdateWrapperManagerTask(Router.EXIT_GRACEFUL));
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_GRACEFUL, false);
ctx.router().shutdownGracefully();
}
}