From fd091e545ba174adc36a9d3370e6d4c040ad33fd Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 28 七月 2022 16:18:41 +0800
Subject: [PATCH] 优化hook订阅机制
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java | 49 +++++++++++++++++++++++--------------------------
1 files changed, 23 insertions(+), 26 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
index e191578..25261f3 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
@@ -92,39 +92,36 @@
@Override
public void process(RequestEvent evt) {
try {
-
taskQueue.offer(new HandlerCatchData(evt, null, null));
responseAck(evt, Response.OK);
if (!taskQueueHandlerRun) {
taskQueueHandlerRun = true;
taskExecutor.execute(()-> {
- while (!taskQueue.isEmpty()) {
- try {
- HandlerCatchData take = taskQueue.poll();
- Element rootElement = getRootElement(take.getEvt());
- String cmd = XmlUtil.getText(rootElement, "CmdType");
+ while (!taskQueue.isEmpty()) {
+ try {
+ HandlerCatchData take = taskQueue.poll();
+ Element rootElement = getRootElement(take.getEvt());
+ String cmd = XmlUtil.getText(rootElement, "CmdType");
- if (CmdType.CATALOG.equals(cmd)) {
- logger.info("鎺ユ敹鍒癈atalog閫氱煡");
- processNotifyCatalogList(take.getEvt());
- } else if (CmdType.ALARM.equals(cmd)) {
- logger.info("鎺ユ敹鍒癆larm閫氱煡");
- processNotifyAlarm(take.getEvt());
- } else if (CmdType.MOBILE_POSITION.equals(cmd)) {
- logger.info("鎺ユ敹鍒癕obilePosition閫氱煡");
- processNotifyMobilePosition(take.getEvt());
- } else {
- logger.info("鎺ユ敹鍒版秷鎭細" + cmd);
- }
- } catch (DocumentException e) {
- throw new RuntimeException(e);
- }
+ if (CmdType.CATALOG.equals(cmd)) {
+ logger.info("鎺ユ敹鍒癈atalog閫氱煡");
+ processNotifyCatalogList(take.getEvt());
+ } else if (CmdType.ALARM.equals(cmd)) {
+ logger.info("鎺ユ敹鍒癆larm閫氱煡");
+ processNotifyAlarm(take.getEvt());
+ } else if (CmdType.MOBILE_POSITION.equals(cmd)) {
+ logger.info("鎺ユ敹鍒癕obilePosition閫氱煡");
+ processNotifyMobilePosition(take.getEvt());
+ } else {
+ logger.info("鎺ユ敹鍒版秷鎭細" + cmd);
}
- taskQueueHandlerRun = false;
- });
+ } catch (DocumentException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ taskQueueHandlerRun = false;
+ });
}
-
-
} catch (SipException | InvalidArgumentException | ParseException e) {
e.printStackTrace();
}
@@ -174,7 +171,7 @@
} else {
mobilePosition.setAltitude(0.0);
}
- logger.info("[鏀跺埌 绉诲姩浣嶇疆璁㈤槄]锛歿}/{}->{}.{}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(),
+ logger.info("[鏀跺埌绉诲姩浣嶇疆璁㈤槄閫氱煡]锛歿}/{}->{}.{}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(),
mobilePosition.getLongitude(), mobilePosition.getLatitude());
mobilePosition.setReportSource("Mobile Position");
--
Gitblit v1.8.0