From 83d254560f016b4650fe0cb2386d58ed4ae7756d Mon Sep 17 00:00:00 2001 From: qiushengjie Date: Wed, 13 Sep 2023 18:55:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ms/api/common/TaskBaseService.java | 26 +++++-------------- .../MoveMaterialAuditProcessTaskService.java | 3 --- 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/common/TaskBaseService.java b/ms-biz/src/main/java/com/ms/api/common/TaskBaseService.java index f3835919..a995e3b3 100644 --- a/ms-biz/src/main/java/com/ms/api/common/TaskBaseService.java +++ b/ms-biz/src/main/java/com/ms/api/common/TaskBaseService.java @@ -1,5 +1,6 @@ package com.ms.api.common; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -14,28 +15,15 @@ public abstract class TaskBaseService implements TaskHandler { @Autowired private PlatformTransactionManager transactionManager; - + @Getter protected int corePoolSiz = 4; - protected int maxPoolSize = 10; - protected int queueCapacity = 500; + @Getter + protected int maxPoolSize = 10000; + @Getter + protected int queueCapacity = 50000; + @Getter protected String taskExecutorName = "TaskPool"; - public int getCorePoolSiz() { - return corePoolSiz; - } - - public int getMaxPoolSize() { - return maxPoolSize; - } - - public int getQueueCapacity() { - return queueCapacity; - } - - public String getTaskExecutorName() { - return taskExecutorName; - } - public Executor getAsyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); // 为了避免线程池满了,导致定时任务无法执行,这里多加一个线程 diff --git a/ms-biz/src/main/java/com/ms/api/task/MoveMaterialAuditProcessTaskService.java b/ms-biz/src/main/java/com/ms/api/task/MoveMaterialAuditProcessTaskService.java index 8f82fcfa..e34b0b5f 100644 --- a/ms-biz/src/main/java/com/ms/api/task/MoveMaterialAuditProcessTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/MoveMaterialAuditProcessTaskService.java @@ -29,9 +29,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import org.springframework.transaction.PlatformTransactionManager; -import org.springframework.transaction.TransactionStatus; -import org.springframework.transaction.support.DefaultTransactionDefinition; import javax.annotation.Resource; import java.util.*;