You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2022/07/18 16:07:32 UTC

[brooklyn-server] 02/04: children batch to correctly look at members

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 2eee5eecded930e55767f6b0d1b2fd8c74b1b832
Author: Alex Heneveld <al...@cloudsoft.io>
AuthorDate: Mon Jul 18 17:04:37 2022 +0100

    children batch to correctly look at members
    
    in line with the description of its contract
---
 .../apache/brooklyn/core/effector/util/ChildrenBatchEffector.java  | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/org/apache/brooklyn/core/effector/util/ChildrenBatchEffector.java b/core/src/main/java/org/apache/brooklyn/core/effector/util/ChildrenBatchEffector.java
index 991e575cba..d103f344b6 100644
--- a/core/src/main/java/org/apache/brooklyn/core/effector/util/ChildrenBatchEffector.java
+++ b/core/src/main/java/org/apache/brooklyn/core/effector/util/ChildrenBatchEffector.java
@@ -20,6 +20,7 @@ package org.apache.brooklyn.core.effector.util;
 
 import org.apache.brooklyn.api.effector.Effector;
 import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.Group;
 import org.apache.brooklyn.api.mgmt.Task;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
@@ -44,7 +45,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * Effector to  invoking an effector across children or members,
+ * Effector to invoke an effector across children (or, in the case of a Group, members)
  */
 public class ChildrenBatchEffector extends AddEffectorInitializerAbstract {
     public static final Effector<Object> EFFECTOR = Effectors.effector(Object.class, "childrenBatchEffector").
@@ -56,7 +57,7 @@ public class ChildrenBatchEffector extends AddEffectorInitializerAbstract {
             .build();
     public static final ConfigKey<Integer> BATCH_SIZE = ConfigKeys.builder(Integer.class)
             .name("batchSize")
-            .description("Supply a limit to the number of elements replaced at a time; 0 (default) means no limit")
+            .description("Supply a limit to the number of children updated at a time; 0 (default) means no limit, 1 means do them sequentially")
             .defaultValue(0)
             .build();
     public static final ConfigKey<String> EFFECTOR_TO_INVOKE = ConfigKeys.builder(String.class)
@@ -137,7 +138,7 @@ public class ChildrenBatchEffector extends AddEffectorInitializerAbstract {
             final boolean failOnEffectorFailure = params.get(FAIL_ON_EFFECTOR_FAILURE);
 
             List<Task<?>> activeTasks = MutableList.of();
-            List<Entity> items = MutableList.copyOf(entity().getChildren());
+            List<Entity> items = MutableList.copyOf(entity() instanceof Group ? ((Group)entity()).getMembers() : entity().getChildren());
             int initialSize = items.size();
             int count = 0;