1 changed files with 22 additions and 0 deletions
@ -0,0 +1,22 @@ |
|||||
|
package com.elink.esua.epdc.config; |
||||
|
|
||||
|
import org.springframework.context.annotation.Bean; |
||||
|
import org.springframework.core.task.AsyncTaskExecutor; |
||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
||||
|
|
||||
|
public class AsyncConfig { |
||||
|
|
||||
|
private static final int MAX_POOL_SIZE = 100; |
||||
|
|
||||
|
private static final int CORE_POOL_SIZE = 50; |
||||
|
|
||||
|
@Bean("asyncTaskExecutor") |
||||
|
public AsyncTaskExecutor asyncTaskExecutor() { |
||||
|
ThreadPoolTaskExecutor asyncTaskExecutor = new ThreadPoolTaskExecutor(); |
||||
|
asyncTaskExecutor.setMaxPoolSize(MAX_POOL_SIZE); |
||||
|
asyncTaskExecutor.setCorePoolSize(CORE_POOL_SIZE); |
||||
|
asyncTaskExecutor.setThreadNamePrefix("async-task-thread-pool-"); |
||||
|
asyncTaskExecutor.initialize(); |
||||
|
return asyncTaskExecutor; |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue