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/02/01 18:47:09 UTC

[17/50] [abbrv] brooklyn-library git commit: Updates ControlledDynamicWebAppClusterImpl to use location defined on controller, if present

Updates ControlledDynamicWebAppClusterImpl to use location defined on controller, if present


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

Branch: refs/heads/0.7.0-incubating
Commit: e45d10f11ac6d3e551de4b5fe227c6cce5059d44
Parents: 5356af4
Author: Martin Harris <gi...@nakomis.com>
Authored: Thu May 21 13:06:27 2015 +0100
Committer: Richard Downer <ri...@apache.org>
Committed: Thu May 28 17:27:35 2015 +0100

----------------------------------------------------------------------
 .../webapp/ControlledDynamicWebAppClusterImpl.java   | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/e45d10f1/software/webapp/src/main/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/main/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterImpl.java b/software/webapp/src/main/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterImpl.java
index 61e2cf2..9a4c212 100644
--- a/software/webapp/src/main/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterImpl.java
+++ b/software/webapp/src/main/java/brooklyn/entity/webapp/ControlledDynamicWebAppClusterImpl.java
@@ -44,6 +44,7 @@ import brooklyn.event.SensorEvent;
 import brooklyn.event.SensorEventListener;
 import brooklyn.event.feed.ConfigToAttributes;
 import brooklyn.location.Location;
+import brooklyn.management.Task;
 import brooklyn.util.collections.MutableList;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.collections.QuorumCheck.QuorumChecks;
@@ -202,10 +203,20 @@ public class ControlledDynamicWebAppClusterImpl extends DynamicGroupImpl impleme
                 addChild(getController());
             }
 
-            // And only start controller if we are parent
-            if (this.equals(getController().getParent())) childrenToStart.add(getController());
+            // And only start controller if we are parent. Favour locations defined on controller, if present
+            Task<List<Void>> startControllerTask = null;
+            if (this.equals(getController().getParent())) {
+                if (getController().getLocations().size() == 0) {
+                    childrenToStart.add(getController());
+                } else {
+                     startControllerTask = Entities.invokeEffectorList(this, MutableList.<Entity>of(getController()), Startable.START, ImmutableMap.of("locations", getController().getLocations()));
+                }
+            }
 
             Entities.invokeEffectorList(this, childrenToStart, Startable.START, ImmutableMap.of("locations", locations)).get();
+            if (startControllerTask != null) {
+                startControllerTask.get();
+            }
 
             // wait for everything to start, then update controller, to ensure it is up to date
             // (will happen asynchronously as members come online, but we want to force it to happen)