From 2c973673d0b99f956ed9684f9a0b31d817ff7d22 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Wed, 13 Sep 2023 15:46:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E5=BF=83=E8=B7=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mocking/service/gb28181/keepalive/KeepaliveService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/gb28181/keepalive/KeepaliveService.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/gb28181/keepalive/KeepaliveService.java index 7a4f3fd..69acb49 100644 --- a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/gb28181/keepalive/KeepaliveService.java +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/gb28181/keepalive/KeepaliveService.java @@ -24,7 +24,7 @@ public class KeepaliveService { public void keepalive(MockingDevice mockingDevice){ unKeepalive(mockingDevice); - scheduledExecutorService.scheduleWithFixedDelay(()->{ + ScheduledFuture scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> { KeepaliveNotifyDTO keepaliveNotifyDTO = KeepaliveNotifyDTO.builder() .deviceId(mockingDevice.getGbDeviceId()) .sn(String.valueOf((int) ((Math.random() * 9 + 1) * 100000))) @@ -40,7 +40,8 @@ public class KeepaliveService { SipUtil.generateFromTag(), callIdHeader); }); - },0,30, TimeUnit.SECONDS); + }, 0, 30, TimeUnit.SECONDS); + map.put(mockingDevice.getGbDeviceId(), scheduledFuture); } public void unKeepalive(MockingDevice mockingDevice){