设备心跳

This commit is contained in:
shikong 2023-09-13 15:46:53 +08:00
parent ee9b8ce08c
commit 2c973673d0

View File

@ -24,7 +24,7 @@ public class KeepaliveService {
public void keepalive(MockingDevice mockingDevice){ public void keepalive(MockingDevice mockingDevice){
unKeepalive(mockingDevice); unKeepalive(mockingDevice);
scheduledExecutorService.scheduleWithFixedDelay(()->{ ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
KeepaliveNotifyDTO keepaliveNotifyDTO = KeepaliveNotifyDTO.builder() KeepaliveNotifyDTO keepaliveNotifyDTO = KeepaliveNotifyDTO.builder()
.deviceId(mockingDevice.getGbDeviceId()) .deviceId(mockingDevice.getGbDeviceId())
.sn(String.valueOf((int) ((Math.random() * 9 + 1) * 100000))) .sn(String.valueOf((int) ((Math.random() * 9 + 1) * 100000)))
@ -41,6 +41,7 @@ public class KeepaliveService {
callIdHeader); callIdHeader);
}); });
}, 0, 30, TimeUnit.SECONDS); }, 0, 30, TimeUnit.SECONDS);
map.put(mockingDevice.getGbDeviceId(), scheduledFuture);
} }
public void unKeepalive(MockingDevice mockingDevice){ public void unKeepalive(MockingDevice mockingDevice){