|
|
|
@ -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();
|
|
|
|
|
// 为了避免线程池满了,导致定时任务无法执行,这里多加一个线程
|
|
|
|
|