You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2016/01/21 02:23:30 UTC

[3/6] incubator-brooklyn git commit: suppress explicit termination in main thread; the shutdown hook is sufficient and it's a bit of work to terminate properly in-thread

suppress explicit termination in main thread;
the shutdown hook is sufficient and it's a bit of work to terminate properly in-thread


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/88b76b71
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/88b76b71
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/88b76b71

Branch: refs/heads/master
Commit: 88b76b71bf7f977ee0c4185bba97e17ea0657baf
Parents: db44cd7
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Jan 20 20:49:13 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Jan 20 21:07:13 2016 +0000

----------------------------------------------------------------------
 .../core/mgmt/internal/BrooklynShutdownHooks.java        |  4 +++-
 .../src/main/java/org/apache/brooklyn/cli/Main.java      | 11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/88b76b71/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
index 677a4f6..91ca5dc 100644
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
+++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/mgmt/internal/BrooklynShutdownHooks.java
@@ -187,7 +187,9 @@ public class BrooklynShutdownHooks {
             }
             entitiesToStop.addAll(entitiesToStopOnShutdown);
             for (ManagementContext mgmt: managementContextsToStopAppsOnShutdown) {
-                entitiesToStop.addAll(mgmt.getApplications());
+                if (mgmt.isRunning()) {
+                    entitiesToStop.addAll(mgmt.getApplications());
+                }
             }
             
             if (entitiesToStop.isEmpty()) {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/88b76b71/brooklyn-server/server-cli/src/main/java/org/apache/brooklyn/cli/Main.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/server-cli/src/main/java/org/apache/brooklyn/cli/Main.java b/brooklyn-server/server-cli/src/main/java/org/apache/brooklyn/cli/Main.java
index 96527db..03be76e 100644
--- a/brooklyn-server/server-cli/src/main/java/org/apache/brooklyn/cli/Main.java
+++ b/brooklyn-server/server-cli/src/main/java/org/apache/brooklyn/cli/Main.java
@@ -482,11 +482,12 @@ public class Main extends AbstractMain {
                 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;
         }