修改线程池
This commit is contained in:
@@ -25,12 +25,10 @@ public class ExecutorConfig {
|
|||||||
@Bean("threadPoolTaskExecutor")
|
@Bean("threadPoolTaskExecutor")
|
||||||
public ThreadPoolTaskExecutor corpusProcessExecutor() {
|
public ThreadPoolTaskExecutor corpusProcessExecutor() {
|
||||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
int corePoolSize = Runtime.getRuntime().availableProcessors() + 2;
|
|
||||||
|
|
||||||
executor.setCorePoolSize(corePoolSize);
|
executor.setCorePoolSize(corePoolSize);
|
||||||
executor.setMaxPoolSize(maxPoolSize);
|
executor.setMaxPoolSize(maxPoolSize);
|
||||||
executor.setQueueCapacity(queueCapacity);
|
executor.setQueueCapacity(queueCapacity);
|
||||||
executor.setThreadNamePrefix("corpus-process-pool-");
|
executor.setThreadNamePrefix("Thread-process-pool-");
|
||||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
executor.setKeepAliveSeconds(keepAliveSeconds);
|
executor.setKeepAliveSeconds(keepAliveSeconds);
|
||||||
executor.initialize();
|
executor.initialize();
|
||||||
|
|||||||
Reference in New Issue
Block a user