Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 999E9185EC for ; Mon, 1 Feb 2016 17:54:08 +0000 (UTC) Received: (qmail 45994 invoked by uid 500); 1 Feb 2016 17:46:54 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 45845 invoked by uid 500); 1 Feb 2016 17:46:54 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 45119 invoked by uid 99); 1 Feb 2016 17:46:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Feb 2016 17:46:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 643C1E3838; Mon, 1 Feb 2016 17:46:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.apache.org Date: Mon, 01 Feb 2016 17:47:09 -0000 Message-Id: <2156ee2c7b0d454c98aa6d127f815630@git.apache.org> In-Reply-To: <07b3e7ba60fb474196ad1699998cae6b@git.apache.org> References: <07b3e7ba60fb474196ad1699998cae6b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Thu May 21 13:06:27 2015 +0100 Committer: Richard Downer 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> startControllerTask = null; + if (this.equals(getController().getParent())) { + if (getController().getLocations().size() == 0) { + childrenToStart.add(getController()); + } else { + startControllerTask = Entities.invokeEffectorList(this, MutableList.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)