Compare commits

...

2 Commits

Author SHA1 Message Date
面包骑士 8d1b33f903 调整每条线程执行条数至10W 2024-09-08 09:19:43 +08:00
面包骑士 75654a54f4 线程池长度修改为8 2024-09-07 20:50:30 +08:00
2 changed files with 4 additions and 3 deletions

View File

@ -23,7 +23,7 @@ import java.util.List;
public final class TaskManager {
// 线程池中默认线程的个数为5
private static int workerNum = 5;
private static int workerNum = 8;
// 工作线程
private final WorkThread[] workThrads;
// 未处理的任务

View File

@ -149,12 +149,13 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>
List<Node> nodeListAll = nodeService.selectNodeList(new NodeReq().buildTaskCode(taskCode));
// 节点初始化
HashMap<String, List<Node>> nodeMap = nodeCheckNorm(nodeListAll);
// 获取查询SQL
String findSql = getFindSql(nodeMap);
// 获取查询条数
int count = getFindCount(findSql, nodeMap);
// 划分线程 每次查询10000
int pageSize = 10000;
// 划分线程 每次查询100000
int pageSize = 100000;
int threadNum = count / pageSize + 1;
log.info("任务 {} 总共需要 {} 条数据, 划分为线程{}条",taskCode,count,threadNum);
for (int i = 0; i < threadNum; i++) {