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

    https://github.com/apache/brooklyn-server/pull/916#discussion_r158319056
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/entity/group/DynamicClusterImpl.java ---
    @@ -799,6 +795,14 @@ protected Entity replaceMember(Entity member, 
@Nullable Location memberLoc, Map<
         /** <strong>Note</strong> for sub-classes; this method can be called 
while synchronized on {@link #mutex}. */
         protected Collection<Entity> grow(int delta) {
             Preconditions.checkArgument(delta > 0, "Must call grow with 
positive delta.");
    +        Integer maxSize = config().get(MAX_SIZE);
    +        if (maxSize != null) {
    +            final int desiredSize = getCurrentSize() + delta;
    +            if (desiredSize > maxSize) {
    +                throw new Resizable.InsufficientCapacityException(
    --- End diff --
    
    I took a fairly strict interpretation of DynamicCluster's contract. If it's 
not possible to fulfil a request for a particular cluster size, or *n* new 
members, in full then I thought it should throw. The consumer should be 
smarter, expect an `InsufficientCapacityException` and ask for less. In the 
case of an auto-scaler I'd expect it to make a second attempt to resize.
    
    If the arguments to resize and resizeByDelta are suggestions rather than 
requirements then best-effort is acceptable.


---

Reply via email to