diff --git a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/PercentageOfParallelExecutor.java b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/PercentageOfParallelExecutor.java index cbed7a4c7..966beadaa 100644 --- a/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/PercentageOfParallelExecutor.java +++ b/liteflow-core/src/main/java/com/yomahub/liteflow/flow/parallel/strategy/PercentageOfParallelExecutor.java @@ -29,7 +29,7 @@ public class PercentageOfParallelExecutor extends ParallelStrategyExecutor { int thresholdCount = (int) Math.ceil(total * whenCondition.getPercentage()); // 已完成任务收集器(对 List 加锁保证线程安全) - List> completedFutures = Collections.synchronizedList(new ArrayList<>(thresholdCount)); + List> completedFutures = Collections.synchronizedList(new ArrayList<>(Math.max(thresholdCount, 1) << 1)); // 阈值触发门闩 CompletableFuture thresholdFuture = new CompletableFuture<>();