From c592740efa9d907eac3ad7d8f6e720608f3e962f Mon Sep 17 00:00:00 2001
From: xiaoxie <hotcoffie@163.com>
Date: 星期日, 01 五月 2022 21:33:56 +0800
Subject: [PATCH] 升级shelljs,解决较高版本node打包时的警告
---
src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java
index 7203ee2..884f040 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/task/impl/MobilePositionSubscribeTask.java
@@ -11,6 +11,8 @@
import javax.sip.Dialog;
import javax.sip.DialogState;
import javax.sip.ResponseEvent;
+import java.util.Timer;
+import java.util.TimerTask;
/**
* 绉诲姩浣嶇疆璁㈤槄鐨勫畾鏃舵洿鏂�
@@ -21,18 +23,23 @@
private ISIPCommander sipCommander;
private Dialog dialog;
+ private Timer timer ;
+
public MobilePositionSubscribeTask(Device device, ISIPCommander sipCommander) {
this.device = device;
this.sipCommander = sipCommander;
}
- @Async
@Override
public void run() {
+ if (timer != null ) {
+ timer.cancel();
+ timer = null;
+ }
sipCommander.mobilePositionSubscribe(device, dialog, eventResult -> {
- if (eventResult.dialog != null || eventResult.dialog.getState().equals(DialogState.CONFIRMED)) {
- dialog = eventResult.dialog;
- }
+// if (eventResult.dialog != null || eventResult.dialog.getState().equals(DialogState.CONFIRMED)) {
+// dialog = eventResult.dialog;
+// }
ResponseEvent event = (ResponseEvent) eventResult.event;
if (event.getResponse().getRawContent() != null) {
// 鎴愬姛
@@ -45,6 +52,13 @@
dialog = null;
// 澶辫触
logger.warn("[绉诲姩浣嶇疆璁㈤槄]澶辫触锛屼俊浠ゅ彂閫佸け璐ワ細 {}-{} ", device.getDeviceId(), eventResult.msg);
+ timer = new Timer();
+ timer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ MobilePositionSubscribeTask.this.run();
+ }
+ }, 2000);
});
}
@@ -58,6 +72,10 @@
* COMPLETED-> Completed Dialog鐘舵��-宸插畬鎴�
* TERMINATED-> Terminated Dialog鐘舵��-缁堟
*/
+ if (timer != null ) {
+ timer.cancel();
+ timer = null;
+ }
if (dialog != null && dialog.getState().equals(DialogState.CONFIRMED)) {
logger.info("鍙栨秷绉诲姩璁㈤槄鏃禿ialog鐘舵�佷负{}", dialog.getState());
device.setSubscribeCycleForMobilePosition(0);
--
Gitblit v1.8.0