Github user neykov commented on the issue:

    https://github.com/apache/brooklyn-server/pull/454
  
    So that's the reason why `onEvent` was called explicitly - to give callers 
of `setExpectedState` synchronous control over `state.actual`. Otherwise the 
change from `config().set(STATE_ACTUAL)` to `setExpectedState` would've been a 
disaster will the code all over making the synchronous assumption. Now it makes 
sense.
    
    >I wonder if child is still reporting starting for a few extra milliseconds 
(set async) because of not doing onEvent(null)
    
    That's the case. This child (`TestSensor`) is manipulating the state by 
calling `setExpectedState` which sets `state.actual` async so it will be 
evaluated **after** start completes.
    
    Even if we fix `TestSensor` there are a ton of places assuming 
`state.actual` has been set synchronously. I think the right thing to do is 
wait in `setExpectedState` for the to-be fired event to be handled. Wonder 
could this lead to deadlocks.


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

Reply via email to