Github user ahgittin commented on the issue:

    https://github.com/apache/brooklyn-server/pull/565
  
    Thanks for the explanation.  I realized from your (excellent) tests that 
the thing we want to allow is to permit an `ImmediateSupplier` to block, which 
was permitted in my code if it was a simple key but not if it was deeper eg in 
a map.  I think we agree that a "dumb" non-immediate `Supplier` should fail if 
it tries to block, but we should be consistent wrt blocking behaviour in 
`getImmediate`, and I agree we should allow it (if someone writes a bad 
`getImmediate` that's on their head, GIGO).
    
    I think we can do this by clearing an interrupt flag in 
`BasicExecutionContext.getImmediately(...)` if it is executing an 
`ImmediateSupplier`.  Does that sound reasonable?
    
    I think we can't avoid the fact that immediate behaviour _is_ complex.  
However we can say something like:
    
    > Simplistically, immediate / non-blocking evaluation uses heuristics under 
the covers to make best-effort without blocking to find a value.  This applies 
among other places to the validation we run during initialization:  validation 
will not be performed where the value isn't yet available.  To permit some 
types of very-brief blocking operations (I/O) or any action sensitive to thread 
interrupts (latch checking), the action should expose an `ImmediateSupplier` 
interface.  If a _caller_ needs fine-grained control over resolution timings, 
use `ValueResolver`.
    
    (Should we add this to the docs?)


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