1
This commit is contained in:
@@ -6,6 +6,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
|||||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Leo
|
* @author Leo
|
||||||
@@ -20,11 +21,10 @@ public class AsyncConfig implements AsyncConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public Executor getAsyncExecutor() {
|
public Executor getAsyncExecutor() {
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
executor.setCorePoolSize(8);
|
executor.setCorePoolSize(10);
|
||||||
executor.setMaxPoolSize(128);
|
executor.setMaxPoolSize(128);
|
||||||
executor.setQueueCapacity(100);
|
executor.setQueueCapacity(500);
|
||||||
executor.setThreadNamePrefix("Async-");
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
executor.initialize();
|
executor.initialize();
|
||||||
return executor;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user