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

    https://github.com/apache/brooklyn-server/pull/480#discussion_r103500728
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java ---
    @@ -352,33 +357,73 @@ public T get() {
             
             //if the expected type is a closure or map and that's what we 
have, we're done (or if it's null);
             //but not allowed to return a future or DeferredSupplier as the 
resolved value
    -        if (v==null || (!forceDeep && type.isInstance(v) && 
!Future.class.isInstance(v) && !DeferredSupplier.class.isInstance(v)))
    +        if (v==null || (!forceDeep && type.isInstance(v) && 
!Future.class.isInstance(v) && !DeferredSupplier.class.isInstance(v) && 
!TaskFactory.class.isInstance(v)))
                 return Maybe.of((T) v);
             
             try {
    -            if (immediately && v instanceof ImmediateSupplier) {
    -                final ImmediateSupplier<?> supplier = 
(ImmediateSupplier<?>) v;
    +            boolean allowImmediateExecution = false;
    +            boolean bailOutAfterImmediateExecution = false;
    +            
    +            if (v instanceof ImmediateSupplier) {
    +                allowImmediateExecution = true;
    +                
    +            } else {
    +                if ((v instanceof TaskFactory<?>) && !(v instanceof 
DeferredSupplier)) {
    +                    v = ((TaskFactory<?>)v).newTask();
    +                    allowImmediateExecution = true;
    +                    bailOutAfterImmediateExecution = true;
    +                    
BrooklynTaskTags.setTransient(((TaskAdaptable<?>)v).asTask());
    +                    if (isEvaluatingImmediately()) {
    +                        // not needed if executing immediately
    +                        BrooklynTaskTags.addTagDynamically( 
((TaskAdaptable<?>)v).asTask(), BrooklynTaskTags.IMMEDIATE_TASK_TAG );
    +                    }
    +                }
    +                
    +                //if it's a task or a future, we wait for the task to 
complete
    +                if (v instanceof TaskAdaptable<?>) {
    +                    v = ((TaskAdaptable<?>) v).asTask();
    --- End diff --
    
    as above, definitely not


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to