Github user sjcorbett commented on the issue:

    https://github.com/apache/brooklyn-server/pull/520
  
    @neykov looks good. I'm going to merge this. Could I ask you to add a 
couple of lines describing the new feature to the section on latches in the 
docs (https://brooklyn.apache.org/v/latest/yaml/advanced-example.html#latches)?
    
    One final thought for future work is how to improve behaviour when the user 
does something they shouldn't do. For example, if someone deployed this 
(totally not contrived!) example:
    ```yaml
    services:
    - type: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess
    
      brooklyn.initializers:
      - type: org.apache.brooklyn.core.sensor.MaxConcurrencySensor
        brooklyn.config:
          name: my-latch
          latch.concurrency.max: 1
          targetType: org.apache.brooklyn.core.sensor.ReleaseableLatch
    
      brooklyn.config: 
        launch.command: sleep 2
        checkRunning.command: true
        install.latch: $brooklyn:self().attributeWhenReady("my-latch")
        start.latch: $brooklyn:self().attributeWhenReady("my-latch")
        stop.latch: $brooklyn:self().attributeWhenReady("my-latch")
    ```
    They'll get an application that is stuck starting forever and that can't be 
stopped either. We could consider having a (long) timeout on the `acquire` or 
perhaps more interesting would be to have reentrant latches. Some strong 
wording in the documentation that this is a bad idea would be sufficient for 
the moment.
    



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