From a574ff094428decbdc35332d184cd0d210716a44 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 22 九月 2022 16:56:20 +0800
Subject: [PATCH] 修复使用队列导致的问题

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
index da2cb9c..ec75015 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
@@ -72,7 +72,7 @@
 
     private boolean taskQueueHandlerRun = false;
 
-    private final ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>();
+    private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>();
 
     @Qualifier("taskExecutor")
     @Autowired
@@ -92,13 +92,14 @@
         if (!taskQueueHandlerRun) {
             taskQueueHandlerRun = true;
             taskExecutor.execute(() -> {
+                logger.info("[澶勭悊鎶ヨ閫氱煡]寰呭鐞嗘暟閲忥細{}", taskQueue.size() );
                 while (!taskQueue.isEmpty()) {
                     SipMsgInfo sipMsgInfo = taskQueue.poll();
                     // 鍥炲200 OK
                     try {
                         responseAck(getServerTransaction(sipMsgInfo.getEvt()), Response.OK);
                     } catch (SipException | InvalidArgumentException | ParseException e) {
-                        logger.error("[鏀跺埌鎶ヨ閫氱煡], 鍥炲200OK澶辫触", e);
+                        logger.error("[澶勭悊鎶ヨ閫氱煡], 鍥炲200OK澶辫触", e);
                     }
 
                     Element deviceIdElement = sipMsgInfo.getRootElement().element("DeviceID");
@@ -112,7 +113,7 @@
                     deviceAlarm.setAlarmMethod(getText(sipMsgInfo.getRootElement(), "AlarmMethod"));
                     String alarmTime = XmlUtil.getText(sipMsgInfo.getRootElement(), "AlarmTime");
                     if (alarmTime == null) {
-                        return;
+                        continue;
                     }
                     deviceAlarm.setAlarmTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(alarmTime));
                     String alarmDescription = getText(sipMsgInfo.getRootElement(), "AlarmDescription");
@@ -182,7 +183,7 @@
                             deviceAlarm.setAlarmType(getText(sipMsgInfo.getRootElement().element("Info"), "AlarmType"));
                         }
                     }
-
+                    logger.info("[鏀跺埌鎶ヨ閫氱煡]鍐呭锛歿}", JSONObject.toJSON(deviceAlarm));
                     if ("7".equals(deviceAlarm.getAlarmMethod()) ) {
                         // 鍙戦�佺粰骞冲彴鐨勬姤璀︿俊鎭�� 鍙戦�乺edis閫氱煡
                         AlarmChannelMessage alarmChannelMessage = new AlarmChannelMessage();
@@ -190,7 +191,7 @@
                         alarmChannelMessage.setAlarmDescription(deviceAlarm.getAlarmDescription());
                         alarmChannelMessage.setGbId(channelId);
                         redisCatchStorage.sendAlarmMsg(alarmChannelMessage);
-                        return;
+                        continue;
                     }
 
                     logger.debug("瀛樺偍鎶ヨ淇℃伅銆佹姤璀﹀垎绫�");
@@ -198,7 +199,7 @@
                     if (sipConfig.isAlarm()) {
                         deviceAlarmService.add(deviceAlarm);
                     }
-                    logger.info("[鏀跺埌鎶ヨ閫氱煡]鍐呭锛歿}", JSONObject.toJSON(deviceAlarm));
+
                     if (redisCatchStorage.deviceIsOnline(sipMsgInfo.getDevice().getDeviceId())) {
                         publisher.deviceAlarmEventPublish(deviceAlarm);
                     }

--
Gitblit v1.8.0