ahgittin commented on a change in pull request #1298:
URL: https://github.com/apache/brooklyn-server/pull/1298#discussion_r802482442



##########
File path: 
core/src/main/java/org/apache/brooklyn/policy/InvokeEffectorOnSensorChange.java
##########
@@ -79,18 +80,29 @@ public void setEntity(EntityLocal entity) {
             LOG.debug("Defaulting to producer==self for {}, on entity {}", 
this, entity);
             producer = entity;
         }
+        lastValue = entity.sensors().get(sensor);
         subscriptions().subscribe(producer, sensor, this);
         LOG.debug("{} subscribed to {} events on {}", new Object[]{this, 
sensor, entity});
     }
 
     @Override
     public void onEvent(SensorEvent<Object> event) {
-        final Effector<?> eff = getEffectorNamed(getConfig(EFFECTOR)).get();
+        final Object newValue = event.getValue();
+
+        synchronized (lock) {
+            LOG.debug("lastValue='{}', newValue='{}'", lastValue, newValue);
+            if (newValue instanceof Comparable && newValue.equals(lastValue)) {

Review comment:
       can we add a `ConfigKey SUPPRESS_DUPLICATES` (this is used elsewhere), 
and only exit here if that is true; it can default to true but at least that 
way if there is a legacy requirement somewhere to act even if values don't 
change then we can support this.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to