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



##########
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) {

Review comment:
       this synch block seems pointless to me, if there were duplicate events 
coming in concurrently there is no guarantee which one is set first.
   
   however i believe subscription delivery is already synched to ensure 
in-order delivery anyway.
   
   so remove this synch block.




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