增加可召回批处理线程池执行器RecyclableBatchThreadPoolExecutor(pr#1343@Gitee)

This commit is contained in:
Looly 2025-06-20 17:54:40 +08:00
parent 0c19f0b9a4
commit c738c2b42b
3 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -29,6 +29,11 @@ public class RecyclableBatchThreadPoolExecutor {
private final ExecutorService executor;
/**
* 构造
*
* @param poolSize 线程池大小
*/
public RecyclableBatchThreadPoolExecutor(int poolSize){
this(poolSize,"recyclable-batch-pool-");
}

View File

@ -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();