Skip to content
Permalink
Browse files
suppress explicit termination in main thread;
the shutdown hook is sufficient and it's a bit of work to terminate properly in-thread
  • Loading branch information
ahgittin committed Jan 20, 2016
1 parent db44cd7 commit 88b76b71bf7f977ee0c4185bba97e17ea0657baf
Showing 2 changed files with 9 additions and 6 deletions.
@@ -187,7 +187,9 @@ public void run() {
}
entitiesToStop.addAll(entitiesToStopOnShutdown);
for (ManagementContext mgmt: managementContextsToStopAppsOnShutdown) {
entitiesToStop.addAll(mgmt.getApplications());
if (mgmt.isRunning()) {
entitiesToStop.addAll(mgmt.getApplications());
}
}

if (entitiesToStop.isEmpty()) {
@@ -482,11 +482,12 @@ public Void apply(CatalogInitialization catInit) {
waitAfterLaunch(mgmt, shutdownHandler);
}

// BrooklynShutdownHookJob will invoke terminate() to do mgmt.terminate() and BrooklynWebServer.stop();
// and System.exit is invoked immediately after ...
// but seems better to do it explicitly here.
// ('launcher' is local to us so the caller *cannot* do it, and no harm in doing it twice.)
launcher.terminate();
// do not shutdown servers here here --
// the BrooklynShutdownHookJob will invoke that and others on System.exit()
// which happens immediately after.
// might be nice to do it explicitly here,
// but the server shutdown process has some special "shutdown apps" options
// so we'd want to refactor BrooklynShutdownHookJob to share code

return null;
}

0 comments on commit 88b76b7

Please sign in to comment.