brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #565: Be truly immediate/non-blocking more ofte...
Date Wed, 15 Mar 2017 16:52:31 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/565#discussion_r106215140
  
    --- Diff: core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
---
    @@ -138,18 +131,14 @@ public T call() {
             // getRaw returns Maybe(val) if the key was explicitly set (where val can be
null)
             // or Absent if the config key was unset.
             Object unresolved = getRaw(key).or(key.getDefaultValue());
    -        final Object marker = new Object();
    -        // Give tasks a short grace period to resolve.
    -        Object resolved = Tasks.resolving(unresolved)
    +        Maybe<Object> resolved = Tasks.resolving(unresolved)
                     .as(Object.class)
    -                .defaultValue(marker)
                     .immediately(true)
                     .deep(true)
                     .context(getContext())
    -                .get();
    -        return (resolved != marker)
    -                ? TypeCoercions.tryCoerce(resolved, key.getTypeToken())
    -                        : Maybe.<T>absent();
    +                .getMaybe();
    +        if (resolved.isAbsent()) return Maybe.Absent.<T>castAbsent(resolved);
    +        return TypeCoercions.tryCoerce(resolved.get(), key.getTypeToken());
    --- End diff --
    
    Now that there's no marker object you can rely on `ValueResolver`'s coercion directly
(by passing in the expected type).


---
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