Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/835#discussion_r143084360
--- Diff:
core/src/main/java/org/apache/brooklyn/core/mgmt/internal/NonDeploymentManagementContext.java
---
@@ -254,7 +250,19 @@ public synchronized SubscriptionContext
getSubscriptionContext(Entity entity) {
if (!this.entity.equals(entity)) throw new
IllegalStateException("Non-deployment context "+this+" can only use a single
Entity: has "+this.entity+", but passed "+entity);
if (mode==NonDeploymentManagementContextMode.MANAGEMENT_STOPPED)
throw new IllegalStateException("Entity "+entity+" is no
longer managed; subscription context not available");
- return subscriptionContext;
+ // see also AbstractManagementContext.getSubscriptionContext -
needed for callbacks, to ensure the correct entity context is set
+ Map<String, ?> subscriptionFlags = ImmutableMap.of("tags",
ImmutableList.of(BrooklynTaskTags.tagForContextEntity(entity)));
+ return new BasicSubscriptionContext(subscriptionFlags, qsm,
entity);
--- End diff --
it's a thin shim so doesn't matter if we cache or recreate
would be nice if we could remove the whole non-deployment mgmt context
stage. suspect there are things like initializers and maybe rebind steps that
we do want to run before other things or be queued to be the first things run
when management context is attached so it may be that this complexity is still
necessary.
---