|
|
@ -1,5 +1,6 @@
|
|
|
|
package com.ms.api.common;
|
|
|
|
package com.ms.api.common;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
@ -14,28 +15,15 @@ public abstract class TaskBaseService implements TaskHandler {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private PlatformTransactionManager transactionManager;
|
|
|
|
private PlatformTransactionManager transactionManager;
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
protected int corePoolSiz = 4;
|
|
|
|
protected int corePoolSiz = 4;
|
|
|
|
protected int maxPoolSize = 10;
|
|
|
|
@Getter
|
|
|
|
protected int queueCapacity = 500;
|
|
|
|
protected int maxPoolSize = 10000;
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
|
|
|
|
protected int queueCapacity = 50000;
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
protected String taskExecutorName = "TaskPool";
|
|
|
|
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() {
|
|
|
|
public Executor getAsyncExecutor() {
|
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
|
|
|
// 为了避免线程池满了,导致定时任务无法执行,这里多加一个线程
|
|
|
|
// 为了避免线程池满了,导致定时任务无法执行,这里多加一个线程
|
|
|
|