From c738c2b42b37cc3e6d9aaa32b113c6b60495e095 Mon Sep 17 00:00:00 2001 From: Looly Date: Fri, 20 Jun 2025 17:54:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=AF=E5=8F=AC=E5=9B=9E?= =?UTF-8?q?=E6=89=B9=E5=A4=84=E7=90=86=E7=BA=BF=E7=A8=8B=E6=B1=A0=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=99=A8`RecyclableBatchThreadPoolExecutor`=EF=BC=88p?= =?UTF-8?q?r#1343@Gitee=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../core/thread/RecyclableBatchThreadPoolExecutor.java | 5 +++++ .../core/thread/RecyclableBatchThreadPoolExecutorTest.java | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a471e161..335dc6d30 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ * 【http 】 `HttpConfig`增加参数`setIgnoreContentLength`可选忽略读取响应contentLength头(issue#ICB1B8@Gitee) * 【core 】 `Assert`新增断言给定集合为空的方法以及单元测试用例(pr#3952@Github) * 【db 】 Db添加FetchSize的全局设置(pr#3978@Github) +* 【core 】 增加可召回批处理线程池执行器`RecyclableBatchThreadPoolExecutor`(pr#1343@Gitee) * ### 🐞Bug修复 * 【core 】 修复`NumberUtil`isNumber方法以L结尾没有小数点判断问题(issue#3938@Github) diff --git a/hutool-core/src/main/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutor.java b/hutool-core/src/main/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutor.java index 97b55ccbc..c6c432555 100644 --- a/hutool-core/src/main/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutor.java +++ b/hutool-core/src/main/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutor.java @@ -29,6 +29,11 @@ public class RecyclableBatchThreadPoolExecutor { private final ExecutorService executor; + /** + * 构造 + * + * @param poolSize 线程池大小 + */ public RecyclableBatchThreadPoolExecutor(int poolSize){ this(poolSize,"recyclable-batch-pool-"); } diff --git a/hutool-core/src/test/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutorTest.java b/hutool-core/src/test/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutorTest.java index d8dc2f182..250865e61 100644 --- a/hutool-core/src/test/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutorTest.java +++ b/hutool-core/src/test/java/cn/hutool/core/thread/RecyclableBatchThreadPoolExecutorTest.java @@ -1,6 +1,7 @@ package cn.hutool.core.thread; import cn.hutool.core.thread.RecyclableBatchThreadPoolExecutor.Warp; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import java.util.*; @@ -18,9 +19,9 @@ public class RecyclableBatchThreadPoolExecutorTest { /** * 批量处理数据 - * @throws InterruptedException */ @Test + @Disabled public void test() throws InterruptedException { int corePoolSize = 10;// 线程池大小 int batchSize = 100;// 每批次数据量 @@ -32,6 +33,7 @@ public class RecyclableBatchThreadPoolExecutorTest { * 普通查询接口加速 */ @Test + @Disabled public void test2() { RecyclableBatchThreadPoolExecutor executor = new RecyclableBatchThreadPoolExecutor(10); long s = System.nanoTime();