| | |
| | | /** |
| | | * 点位在线检测 |
| | | */ |
| | | //TODO:视频离线次数、监测次数 |
| | | public void pointOnline() throws ExecutionException, InterruptedException { |
| | | log.info("开始检测点位在线"); |
| | | Integer times = 2; |
| | |
| | | OnlineCheckThread thread = new OnlineCheckThread(monitor, checkPointUtil, time); |
| | | return thread.call(); // 假设 OnlineCheckThread 实现了 Callable 接口 |
| | | }, executorService) |
| | | .orTimeout(30, TimeUnit.SECONDS) |
| | | .orTimeout(40, TimeUnit.SECONDS) |
| | | .exceptionally(ex -> { |
| | | if (ex instanceof TimeoutException) { |
| | | log.error("任务执行超时:"); |
| | | log.error("任务执行超时:"+monitor.getIp()); |
| | | } else { |
| | | log.error("任务执行异常:" + ex); |
| | | log.error("任务执行异常:"+monitor.getIp() + ex); |
| | | } |
| | | int checkTimes = 1; |
| | | int offLineTimes = 1; |
| | | //TODO:BUG |
| | | Map<String, Object> map = (Map<String, Object>) redisTemplate.opsForHash().get(RedisConstant.ONLINE_KEY, monitor.getIp()); |
| | | if (!CollectionUtils.isEmpty(map)) { |
| | | checkTimes = (Integer) map.get("checkTimes") + 1; |