Fix log.warn when calling Location.unmanage Previously, if a location being unmanaged had a parent, weâd try to unmanaged it twice - the second time would give a log.warn
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/3118f427 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/3118f427 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/3118f427 Branch: refs/heads/master Commit: 3118f427b4bc8e95ce4c19a54f97325957687d61 Parents: 3df2b8b Author: Aled Sage <aled.s...@gmail.com> Authored: Tue Mar 22 12:45:03 2016 +0000 Committer: Aled Sage <aled.s...@gmail.com> Committed: Tue Mar 22 12:45:03 2016 +0000 ---------------------------------------------------------------------- .../java/org/apache/brooklyn/core/location/AbstractLocation.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3118f427/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java b/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java index dc48862..d4e565e 100644 --- a/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java +++ b/core/src/main/java/org/apache/brooklyn/core/location/AbstractLocation.java @@ -706,7 +706,9 @@ public abstract class AbstractLocation extends AbstractBrooklynObject implements } child.setParent(null); - if (isManaged()) { + if (isManaged() && Locations.isManaged(child)) { + // This is called as part of child's LocalLocationManager.unmanage; don't try to + // unmanage it yet again as then would get a log.warn! getManagementContext().getLocationManager().unmanage(child); } }