parent
26f71afade
commit
96691ea013
2 changed files with 40 additions and 21 deletions
@ -0,0 +1,21 @@ |
|||||||
|
package com.blockchain.server.otc.common.config; |
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean; |
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class ApplicationConfig { |
||||||
|
@Bean |
||||||
|
public ThreadPoolTaskExecutor executor() { |
||||||
|
ThreadPoolTaskExecutor threadPoolTaskExecutor = new ThreadPoolTaskExecutor(); |
||||||
|
threadPoolTaskExecutor.setCorePoolSize(5); |
||||||
|
threadPoolTaskExecutor.setMaxPoolSize(10); |
||||||
|
threadPoolTaskExecutor.setQueueCapacity(50); |
||||||
|
threadPoolTaskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); |
||||||
|
threadPoolTaskExecutor.setThreadNamePrefix("executor-"); |
||||||
|
return threadPoolTaskExecutor; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue