ÎļþÃû´Ó ard-work/src/main/java/com/ruoyi/device/hiksdk/config/AsyncConfiguration.java ÐÞ¸Ä |
| | |
| | | package com.ruoyi.device.hiksdk.config; |
| | | package com.ruoyi.config; |
| | | |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | executor.initialize(); |
| | | return executor; |
| | | } |
| | | @Bean("alarmExecutor") |
| | | public Executor alarmExecutor(){ |
| | | ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); |
| | | //é
ç½®æ ¸å¿çº¿ç¨æ° |
| | | executor.setCorePoolSize(15); |
| | | //é
ç½®æå¤§çº¿ç¨æ° |
| | | executor.setMaxPoolSize(30); |
| | | //é
ç½®éåå¤§å° |
| | | executor.setQueueCapacity(1000); |
| | | //线ç¨çåç§°åç¼ |
| | | executor.setThreadNamePrefix("alarmExecutor-"); |
| | | //çº¿ç¨æ´»è·æ¶é´ï¼ç§ï¼ |
| | | //executor.setKeepAliveSeconds(60); |
| | | //çå¾
ææä»»å¡ç»æååå
³éçº¿ç¨æ± |
| | | executor.setWaitForTasksToCompleteOnShutdown(true); |
| | | //设置æç»çç¥ |
| | | //executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); |
| | | //æ§è¡åå§å |
| | | executor.initialize(); |
| | | return executor; |
| | | } |
| | | } |