Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/480#discussion_r103498263
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/util/core/task/BasicExecutionContext.java
 ---
    @@ -96,7 +98,50 @@ public ExecutionManager getExecutionManager() {
         /** returns tasks started by this context (or tasks which have all the 
tags on this object) */
         @Override
         public Set<Task<?>> getTasks() { return 
executionManager.getTasksWithAllTags(tags); }
    -     
    +
    +    /** performs execution without spawning a new task thread, though it 
does temporarily set a fake task for the purpose of getting context;
    +     * currently supports suppliers or callables  */
    +    @SuppressWarnings("unchecked")
    +    @Override
    +    public <T> Maybe<T> getImmediately(Object callableOrSupplier) {
    +        BasicTask<?> fakeTaskForContext;
    +        if (callableOrSupplier instanceof BasicTask) {
    +            fakeTaskForContext = (BasicTask<?>)callableOrSupplier;
    --- End diff --
    
    as noted above leaving the task running in background (or possibly not 
submitting it) is the right thing to do for immediate execution of a task; 
cancelling it is risky unless we know the task is dedicated to this one usage 
(hence preferring `TaskFactory`); in particular 
`EntityConfigTest.testGetTaskNonBlockingKey()` fails if 
`allowImmediateExecution=true`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to