From d342a08af5c3619b1471d2838cb2aa4400fc5e14 Mon Sep 17 00:00:00 2001 From: luoyi <972849752@qq.com> Date: Tue, 15 Jul 2025 13:37:18 +0800 Subject: [PATCH] =?UTF-8?q?bug=20PercentageOfParallelExecutor=20=E4=B8=AD?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=94=B6=E9=9B=86=E5=88=97=E8=A1=A8=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E5=88=9D=E5=A7=8B=E5=80=BC=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E4=B8=8D=E5=BF=85=E8=A6=81=E7=9A=84=E6=89=A9=E5=AE=B9=EF=BC=9B?= =?UTF-8?q?=E5=A4=8D=E5=8E=9F=E5=85=B6=E4=BB=96=E6=B5=8B=E8=AF=95=E6=A1=88?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../flow/parallel/strategy/PercentageOfParallelExecutor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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<>();