Github user aledsage commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/835#discussion_r142919316 --- Diff: core/src/main/java/org/apache/brooklyn/core/objs/AbstractEntityAdjunct.java --- @@ -402,10 +415,21 @@ public void setDisplayName(String name) { this.name = name; } + @Override + public ManagementContext getManagementContext() { + ManagementContext result = super.getManagementContext(); + if (result!=null) return result; + if (entity!=null) { + return ((EntityInternal)entity).getManagementContext(); + } + return null; + } + public void setEntity(EntityLocal entity) { if (destroyed.get()) throw new IllegalStateException("Cannot set entity on a destroyed entity adjunct"); this.entity = entity; - this.execution = ((EntityInternal) entity).getExecutionContext(); + this.execution = new BasicExecutionContext( getManagementContext().getExecutionManager(), --- End diff -- I'd prefer us to add `managementContext.getExecutionContext(entity, adjunct)` (so it follows the same pattern as for `getSubscriptionContext`).
---