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

    https://github.com/apache/brooklyn-server/pull/386#discussion_r84884682
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/policy/InvokeEffectorOnCollectionSensorChange.java
 ---
    @@ -128,10 +132,25 @@ public void setEntity(EntityLocal entity) {
         }
     
         @Override
    +    protected boolean isBusy() {
    +        return super.isBusy() || moreUpdatesComing.get();
    +    }
    +
    +    @Override
         public void onEvent(SensorEvent<Collection<?>> event) {
             final Set<Object> newValue = event.getValue() != null
                     ? new LinkedHashSet<>(event.getValue())
                     : ImmutableSet.of();
    +        if (isBusySensorEnabled()) {
    +            // There are more events coming that this policy hasn't been 
notified of if the
    +            // value received in the event does not match the current 
value of the sensor.
    +            final Collection<?> sensorVal = 
entity.sensors().get(getTriggerSensor());
    +            final Set<Object> sensorValSet = sensorVal != null
    +                ? new LinkedHashSet<>(sensorVal)
    +                : ImmutableSet.of();
    +            final boolean moreComing = !Objects.equals(newValue, 
sensorValSet);
    +            moreUpdatesComing.set(moreComing);
    +        }
    --- End diff --
    
    Why not do this in the parent class? It would be useful in 
"InvokeEffectorOnSensorChange" as well.


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