From c4fc4abf7cbaa621f7ca1946f67c786c6cd55b68 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 17 十月 2022 09:39:21 +0800
Subject: [PATCH] 优化代码空字符串判断
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java | 12 +++++++-----
1 files changed, 7 insertions(+), 5 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 dc7689c..f78ee18 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
@@ -29,10 +29,12 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;
+import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import javax.sip.InvalidArgumentException;
import javax.sip.RequestEvent;
+import javax.sip.ServerTransaction;
import javax.sip.SipException;
import javax.sip.header.FromHeader;
import javax.sip.message.Response;
@@ -77,7 +79,7 @@
private boolean taskQueueHandlerRun = false;
- private final ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
+ private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>();
@Qualifier("taskExecutor")
@Autowired
@@ -93,7 +95,8 @@
public void process(RequestEvent evt) {
try {
taskQueue.offer(new HandlerCatchData(evt, null, null));
- responseAck(evt, Response.OK);
+ ServerTransaction serverTransaction = getServerTransaction(evt);
+ responseAck(serverTransaction, Response.OK);
if (!taskQueueHandlerRun) {
taskQueueHandlerRun = true;
taskExecutor.execute(()-> {
@@ -121,10 +124,9 @@
}
} catch (DocumentException e) {
logger.error("澶勭悊NOTIFY娑堟伅鏃堕敊璇�", e);
- } finally {
- taskQueueHandlerRun = false;
}
}
+ taskQueueHandlerRun = false;
});
}
} catch (SipException | InvalidArgumentException | ParseException e) {
@@ -157,7 +159,7 @@
String channelId = deviceIdElement.getTextTrim().toString();
Device device = redisCatchStorage.getDevice(deviceId);
if (device != null) {
- if (!StringUtils.isEmpty(device.getName())) {
+ if (!ObjectUtils.isEmpty(device.getName())) {
mobilePosition.setDeviceName(device.getName());
}
}
--
Gitblit v1.8.0