Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/771#discussion_r35632768
  
    --- Diff: 
usage/rest-server/src/test/java/brooklyn/rest/resources/ServerResourceTest.java 
---
    @@ -134,4 +131,52 @@ void testGetMissingConfigThrowsException() throws 
Exception {
                 }
             }
         }
    +
    +    // Alternatively could reuse a blocking location, see 
brooklyn.entity.basic.SoftwareProcessEntityTest.ReleaseLatchLocation
    +    @ImplementedBy(StopLatchEntityImpl.class)
    +    public interface StopLatchEntity extends EmptySoftwareProcess {
    +        public void unblock();
    +        public boolean isBlocked();
    +    }
    +
    +    public static class StopLatchEntityImpl extends 
EmptySoftwareProcessImpl implements StopLatchEntity {
    +        private AtomicBoolean lock = new AtomicBoolean();
    +        private boolean isBlocked;
    +
    +        @Override
    +        public void unblock() {
    +            synchronized (lock) {
    +                lock.set(true);
    +                lock.notifyAll();
    +            }
    +        }
    +
    +        @Override
    +        protected void postStop() {
    +            super.preStop();
    +            synchronized (lock) {
    +                if (!lock.get()) {
    --- End diff --
    
    See previous comment in ReleaseLatchLocation.release about `synchronized`. 
Could change to `CountDownLatch`.


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