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/15 00:54:27 UTC

[13/24] incubator-brooklyn git commit: in AbstractApplication, don't infer locations to pass to start(...)

in AbstractApplication, don't infer locations to pass to start(...)

with this, locations defined on an app are no longer inserted automatically by BasicApplication.start().  this is because locations are now normally defined on yaml.  entities typically prefer a location if supplied to start(...), but if none are supplied there they look in local configuration and then ancestor configuration.  if BasicApplication passes their configured location to the start method, that is trumping any location defined on they descendant entity, which is probably not desired.  if an entity does not define a location, there is no change to behaviour as it looks up ancestor location regardless.  but this fixes a bug where if a location A is defined on an application, and another location B defined on a particular entity in that application, the entity now uses B whereas previously it was using A.  this makes explicit entity startup behaviour consistent with how an entity spec used in a cluster works (which has and still prefers the location defined in the entity spec)
 .


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

Branch: refs/heads/master
Commit: add81aada1d5da340248f03c6438585d4c7aea5c
Parents: 70ed345
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Jan 14 13:36:05 2016 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Jan 14 14:43:01 2016 +0000

----------------------------------------------------------------------
 .../org/apache/brooklyn/core/entity/AbstractApplication.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/add81aad/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
index e000997..3fd4b05 100644
--- a/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
+++ b/brooklyn-server/core/src/main/java/org/apache/brooklyn/core/entity/AbstractApplication.java
@@ -38,6 +38,8 @@ import org.apache.brooklyn.util.time.Time;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.collect.ImmutableSet;
+
 /**
  * Users can extend this to define the entities in their application, and the relationships between
  * those entities. Users should override the {@link #init()} method, and in there should create 
@@ -143,7 +145,8 @@ public abstract class AbstractApplication extends AbstractEntity implements Star
     @Override
     public void start(Collection<? extends Location> locations) {
         this.addLocations(locations);
-        Collection<? extends Location> locationsToUse = getLocations();
+        // 2016-01: only pass locations passed to us, as per ML discussion
+        Collection<? extends Location> locationsToUse = locations==null ? ImmutableSet.<Location>of() : locations;
         ServiceProblemsLogic.clearProblemsIndicator(this, START);
         ServiceStateLogic.ServiceNotUpLogic.updateNotUpIndicator(this, Attributes.SERVICE_STATE_ACTUAL, "Application starting");
         setExpectedStateAndRecordLifecycleEvent(Lifecycle.STARTING);