brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From geomacy <...@git.apache.org>
Subject [GitHub] brooklyn-server pull request #390: BROOKLYN-356: fix race in transformer by ...
Date Wed, 26 Oct 2016 19:44:31 GMT
Github user geomacy commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/390#discussion_r85105289
  
    --- Diff: camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
---
    @@ -353,6 +386,33 @@ public DslSensorSupplier(DslComponent component, Object sensorIndicator)
{
             }
     
             @Override
    +        public Maybe<Sensor<?>> getImmediately() {
    +            return getImmediately(sensorName, false);
    +        }
    +        
    +        protected Maybe<Sensor<?>> getImmediately(Object si, boolean resolved)
{
    +            if (si instanceof Sensor) {
    +                return Maybe.<Sensor<?>>of((Sensor<?>)si);
    +            } else if (si instanceof String) {
    +                Entity targetEntity = component.get();
    +                Sensor<?> result = null;
    +                if (targetEntity!=null) {
    +                    result = targetEntity.getEntityType().getSensor((String)si);
    +                }
    +                if (result!=null) return Maybe.<Sensor<?>>of(result);
    +                return Maybe.<Sensor<?>>of(Sensors.newSensor(Object.class,
(String)si));
    --- End diff --
    
    In `attributeWhenReady` above at line 286 you return a `Maybe.absent()` if result is `null`;
returning a `newSensor` here seems inconsistent, what is the reason for the different behaviour
here?


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