brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #480: Config self reference fix
Date Sat, 18 Feb 2017 01:28:04 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/480#discussion_r101878724
  
    --- Diff: core/src/main/java/org/apache/brooklyn/util/core/task/ValueResolver.java ---
    @@ -352,33 +357,51 @@ 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;
    +            if (isEvaluatingImmediately() && v instanceof ImmediateSupplier)
{
    +                final ImmediateSupplier<Object> supplier = (ImmediateSupplier<Object>)
v;
                     try {
    -                    Maybe<?> result = supplier.getImmediately();
    +                    Maybe<Object> result = exec.getImmediately(supplier);
                         
                         // Recurse: need to ensure returned value is cast, etc
                         return (result.isPresent())
                                 ? recursive
                                     ? new ValueResolver(result.get(), type, this).getMaybe()
                                     : result
    -                            : Maybe.<T>absent();
    +                            : result;
                     } catch (ImmediateSupplier.ImmediateUnsupportedException e) {
                         log.debug("Unable to resolve-immediately for "+description+" ("+v+");
falling back to executing with timeout", e);
                     }
                 }
                 
    +            // TODO if evaluating immediately should use a new ExecutionContext.submitImmediate(...)
    +            // and sets a timeout but which wraps a task but does not spawn a new thread
    +            
    +            if ((v instanceof TaskFactory<?>) && !(v instanceof DeferredSupplier))
{
    --- End diff --
    
    TODO think about this


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

Mime
View raw message