ard-work/src/main/java/com/ruoyi/alarm/config/AsyncConfiguration.java
@@ -4,6 +4,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.AsyncConfigurer; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @@ -19,7 +20,7 @@ **/ @Configuration @EnableAsync public class AsyncConfiguration { public class AsyncConfiguration{ @Value("${ThreadPoolTask.corePoolSize}") Integer corePoolSize; @Value("${ThreadPoolTask.maxPoolSize}") @@ -40,27 +41,6 @@ executor.setQueueCapacity(queueCapacity); //线程的名称前缀 executor.setThreadNamePrefix("alarmExecutor-"); //线程活跃时间(秒) executor.setKeepAliveSeconds(keepAliveSeconds); //等待所有任务结束后再关闭线程池 executor.setWaitForTasksToCompleteOnShutdown(true); //设置拒绝策略 executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //执行初始化 executor.initialize(); return executor; } @Bean("loginExecutor") public Executor loginExecutor(){ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); //配置核心线程数 executor.setCorePoolSize(corePoolSize); //配置最大线程数 executor.setMaxPoolSize(maxPoolSize); //配置队列大小 executor.setQueueCapacity(queueCapacity); //线程的名称前缀 executor.setThreadNamePrefix("loginExecutor-"); //线程活跃时间(秒) executor.setKeepAliveSeconds(keepAliveSeconds); //等待所有任务结束后再关闭线程池 @@ -92,4 +72,26 @@ executor.initialize(); return executor; } @Bean("globalExecutor") public Executor globalExecutor(){ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); //配置核心线程数 executor.setCorePoolSize(10); //配置最大线程数 executor.setMaxPoolSize(15); //配置队列大小 executor.setQueueCapacity(25); //线程的名称前缀 executor.setThreadNamePrefix("globalExecutor-"); //线程活跃时间(秒) executor.setKeepAliveSeconds(keepAliveSeconds); //等待所有任务结束后再关闭线程池 executor.setWaitForTasksToCompleteOnShutdown(true); //设置拒绝策略 executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); //执行初始化 executor.initialize(); return executor; } } ard-work/src/main/java/com/ruoyi/alarm/radar/service/impl/ArdRadarServiceImpl.java
@@ -43,7 +43,7 @@ * 2023/11/2 9:00:55 */ @Override @Async @Async("globalExecutor") public void forceGuide(String msg) { try { Map<String, Object> msgMap = JSONObject.parseObject(msg, Map.class); @@ -86,7 +86,7 @@ * 2023/11/2 9:00:55 */ @Override @Async @Async("globalExecutor") public void followGuide(String msg) { try { RadarAlarmData radarFollowData = JSONObject.parseObject(msg, RadarAlarmData.class); ard-work/src/main/java/com/ruoyi/call/listener/MsgListener.java
@@ -26,7 +26,7 @@ @Slf4j(topic = "msgListener") public class MsgListener { @Async @Async("globalExecutor") @EventListener(MessageEvent.class) public void ArdCallHistoryEventListener(MessageEvent messageEvent) { log.debug("监听到会话消息事件:"+messageEvent.getArdCallHistory().getContent()); ard-work/src/main/java/com/ruoyi/storage/minio/service/impl/StorageMinioEventServiceImpl.java
@@ -108,7 +108,7 @@ return storageMinioEventMapper.deleteStorageMinioEventById(id); } @Async @Async("globalExecutor") @Override public void parseStorageMinioEvent(String message) { try { ard-work/src/main/java/com/ruoyi/utils/sdk/dhsdk/service/impl/DahuaSDK.java
@@ -134,7 +134,7 @@ } @Override @Async("loginExecutor") @Async("globalExecutor") public AjaxResult asyncLogin(ArdCameras camera) { try { LoginModule.init(disConnect, haveReConnect); ard-work/src/main/java/com/ruoyi/utils/sdk/hiksdk/service/impl/HikvisionSDK.java
@@ -184,7 +184,7 @@ * @修改人和其它信息 */ @Override @Async("loginExecutor") @Async("globalExecutor") public AjaxResult asyncLogin(ArdCameras camera) { try { // 初始化 @@ -237,17 +237,6 @@ return AjaxResult.warn("设备[" + camera.getIp() + ":" + camera.getPort() + "]登录失败: " + SdkErrorCodeEnum.getDescByCode(errorCode) + "(" + errorCode + ")"); } log.debug("Login Success 【 " + camera.getIp() + ":" + camera.getPort() + " 】"); synchronized (_lock) { if (fExceptionCallBack == null) { fExceptionCallBack = new ExceptionCallBack();//异常回调 //设置异常回调函数(可在回调函数中获取设备上下线状态等) if (!hCNetSDK.NET_DVR_SetExceptionCallBack_V30(0, 0, fExceptionCallBack, null)) { log.debug("Set fExceptionCallBack function fail"); } else { log.debug("Set fExceptionCallBack function successfully!"); } } } GlobalVariable.loginMap.put(camera.getId(), lUserID); GlobalVariable.loginCameraMap.put(lUserID, camera); ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/SysLoginService.java
@@ -152,7 +152,7 @@ * * @param loginUser 登录用户 */ @Async @Async("globalExecutor") public String getRongCloudToken(LoginUser loginUser) { try { String userId = loginUser.getUserId();