Github user ahgittin commented on a diff in the pull request: https://github.com/apache/brooklyn-server/pull/816#discussion_r141612764 --- Diff: core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java --- @@ -66,23 +75,37 @@ final Set<Object> tags = new LinkedHashSet<Object>(); public BasicExecutionContext(ExecutionManager executionManager) { - this(Collections.emptyMap(), executionManager); + this(executionManager, null); } /** + * As {@link #BasicExecutionContext(ExecutionManager, Iterable)} but taking a flags map. * Supported flags are {@code tag} and {@code tags} * * @see ExecutionManager#submit(Map, TaskAdaptable) + * @deprecated since 0.12.0 use {@link #BasicExecutionContext(ExecutionManager, Iterable)} */ + @Deprecated public BasicExecutionContext(Map<?, ?> flags, ExecutionManager executionManager) { + this(executionManager, MutableSet.of().put(flags.remove("tag")).putAll((Iterable<?>)flags.remove("tag"))); + if (!flags.isEmpty()) { + log.warn("Unexpected flags passed to execution context ("+tags+"): "+flags, + new Throwable("Trace for unexpected flags passed to execution context")); + } + } + + /** + * Creates an execution context which wraps {@link ExecutionManager} + * adding the given tags to all tasks submitted through this context. + */ + public BasicExecutionContext(ExecutionManager executionManager, Iterable<Object> tagsForThisContext) { --- End diff -- agree
---