mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 04:35:14 +08:00
增加可召回批处理线程池执行器RecyclableBatchThreadPoolExecutor
(pr#1343@Gitee)
This commit is contained in:
parent
0c19f0b9a4
commit
c738c2b42b
@ -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)
|
||||
|
@ -29,6 +29,11 @@ public class RecyclableBatchThreadPoolExecutor {
|
||||
|
||||
private final ExecutorService executor;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
*
|
||||
* @param poolSize 线程池大小
|
||||
*/
|
||||
public RecyclableBatchThreadPoolExecutor(int poolSize){
|
||||
this(poolSize,"recyclable-batch-pool-");
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user