Expose FixedListMachineProvisioningLocation.getInUse - Useful for testing; and no harm exposing it as returns a copy so result can't be side-effected.
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/129bd9ce Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/129bd9ce Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/129bd9ce Branch: refs/heads/0.5.0 Commit: 129bd9ce8d9750a3be9eaa7ebc18f847ae797633 Parents: a253e39 Author: Aled Sage <[email protected]> Authored: Wed Apr 17 14:42:30 2013 +0100 Committer: Aled Sage <[email protected]> Committed: Thu Apr 25 11:24:55 2013 +0100 ---------------------------------------------------------------------- .../basic/FixedListMachineProvisioningLocation.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/129bd9ce/core/src/main/java/brooklyn/location/basic/FixedListMachineProvisioningLocation.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/brooklyn/location/basic/FixedListMachineProvisioningLocation.java b/core/src/main/java/brooklyn/location/basic/FixedListMachineProvisioningLocation.java index 721d383..51bf5e3 100644 --- a/core/src/main/java/brooklyn/location/basic/FixedListMachineProvisioningLocation.java +++ b/core/src/main/java/brooklyn/location/basic/FixedListMachineProvisioningLocation.java @@ -14,10 +14,7 @@ import brooklyn.location.Location; import brooklyn.location.MachineLocation; import brooklyn.location.MachineProvisioningLocation; import brooklyn.location.NoMachinesAvailableException; -import brooklyn.location.cloud.AbstractCloudMachineProvisioningLocation; import brooklyn.util.MutableMap; -import brooklyn.util.config.ConfigBag; -import brooklyn.util.exceptions.Exceptions; import brooklyn.util.flags.SetFromFlag; import brooklyn.util.text.WildcardGlobs; import brooklyn.util.text.WildcardGlobs.PhraseTreatment; @@ -41,7 +38,7 @@ implements MachineProvisioningLocation<T>, Closeable { // TODO Synchronization looks very wrong for accessing machines/inUse // e.g. removeChildLocation doesn't synchronize when doing machines.remove(...), - // and getMachines() and getInUse() return the real sets risking + // and getMachines() returns the real sets risking // ConcurrentModificationException in the caller if it iterates over them etc. private Object lock; @@ -123,16 +120,16 @@ implements MachineProvisioningLocation<T>, Closeable { return machines; } - protected Set<T> getInUse() { - return inUse; - } - public Set<T> getAvailable() { Set<T> a = Sets.newLinkedHashSet(machines); a.removeAll(inUse); return a; } + public Set<T> getInUse() { + return Sets.newLinkedHashSet(inUse); + } + public Set<T> getAllMachines() { return ImmutableSet.copyOf(machines); }
