brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aledsage <>
Subject [GitHub] brooklyn-server pull request #480: Config self reference fix
Date Tue, 28 Feb 2017 14:08:25 GMT
Github user aledsage commented on a diff in the pull request:
    --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/
    @@ -554,15 +562,55 @@ protected String resolveKeyName(boolean immediately) {
                         .displayName("retrieving config for "+keyName)
    -                    .body(new Callable<Object>() {
    -                        @Override
    -                        public Object call() throws Exception {
    -                            Entity targetEntity = component.get();
    -                            String keyNameS = resolveKeyName(true);
    -                            ConfigKey<?> key = targetEntity.getEntityType().getConfigKey(keyNameS);
    -                            return targetEntity.getConfig(key != null ? key : ConfigKeys.newConfigKey(Object.class,
    -                        }})
    -                    .build();
    +                    .body(newCallable(false)).build();
    +        }
    +        private Callable<Object> newCallable(final boolean immediate) {
    --- End diff --
    Minor: I'd have included a comment on this method to say that if immediate then the return
value will be `Maybe<Object>` whereas if `!immediate` then the return value of the callable
will be the actual `Object`. The difference of those semantics are not obvious in the method,
but are relied upon by the caller.
    It's surprising that the same method is used to return the two different styles of result,
but I see why you did it (to reduce duplication).

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

View raw message