brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neykov <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Don't leak machines on shutdown
Date Wed, 29 Jul 2015 13:50:13 GMT
Github user neykov commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/771#discussion_r35760168
  
    --- Diff: software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessEntityTest.java
---
    @@ -568,4 +706,85 @@ protected String getInstallLabelExtraSalt() {
                 return (String)getEntity().getConfigRaw(ConfigKeys.newStringConfigKey("salt"),
true).or((String)null);
             }
         }
    +
    +    public static class ReleaseLatchLocation extends SimulatedLocation {
    +        private static final long serialVersionUID = 1L;
    +        
    +        private AtomicBoolean lock = new AtomicBoolean();
    +        private boolean isBlocked;
    +
    +        public void unblock() {
    +            synchronized (lock) {
    +                lock.set(true);
    +                lock.notifyAll();
    +            }
    +        }
    +        @Override
    +        public void release(MachineLocation machine) {
    +            super.release(machine);
    +            synchronized (lock) {
    +                if (!lock.get()) {
    +                    try {
    +                        isBlocked = true;
    +                        lock.wait();
    +                        isBlocked = false;
    +                    } catch (InterruptedException e) {
    +                        throw Exceptions.propagate(e);
    +                    }
    +                }
    +            }
    +        }
    +
    +        public boolean isBlocked() {
    +            return isBlocked;
    +        }
    +
    +    }
    +
    +    public static class GenericSoftwareProcessTestDriver implements SoftwareProcessDriver
{
    --- End diff --
    
    Agree that some code deleting is in order. In this case I explicitly didn't want an SshDriver
implementation though (as most of the above are).


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message