| | |
| | | |
| | | private final FebsProperties properties; |
| | | |
| | | // 专门用于MVC异步处理的线程池 |
| | | @Bean("mvcTaskExecutor") |
| | | public ThreadPoolTaskExecutor mvcTaskExecutor() { |
| | | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
| | | executor.setCorePoolSize(20); |
| | | executor.setMaxPoolSize(100); |
| | | executor.setQueueCapacity(500); |
| | | executor.setThreadNamePrefix("mvc-async-"); |
| | | executor.setWaitForTasksToCompleteOnShutdown(true); |
| | | executor.setAwaitTerminationSeconds(60); |
| | | executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
| | | executor.initialize(); |
| | | return executor; |
| | | } |
| | | |
| | | @Bean(FebsConstant.ASYNC_POOL) |
| | | public ThreadPoolTaskExecutor asyncThreadPoolTaskExecutor(){ |
| | | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
| | | executor.setCorePoolSize(5); |
| | | executor.setMaxPoolSize(20); |
| | | executor.setQueueCapacity(200); |
| | | executor.setCorePoolSize(10); |
| | | executor.setMaxPoolSize(50); |
| | | executor.setQueueCapacity(300); |
| | | executor.setKeepAliveSeconds(30); |
| | | executor.setThreadNamePrefix("Febs-Async-Thread"); |
| | | executor.setWaitForTasksToCompleteOnShutdown(true); |