From 17278523d940d34cd67d084de4a6c71cf035cb9b Mon Sep 17 00:00:00 2001 From: zxb <919411476@qq.com> Date: Mon, 21 Aug 2023 16:55:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8E=86=E5=8F=B2=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=8B=89=E5=8F=96=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/conf/ServerLoggerImpl.java | 28 ++++++------------- .../event/record/RecordEndEventListener.java | 2 +- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java index c7b1f6e6..7a24ee3c 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/ServerLoggerImpl.java @@ -9,12 +9,11 @@ import gov.nist.javax.sip.stack.SIPTransactionStack; import javax.sip.SipStack; import java.util.Properties; +@SuppressWarnings("unused") public class ServerLoggerImpl implements ServerLogger { private boolean showLog = true; - private SIPTransactionStack sipStack; - protected StackLogger stackLogger; @Override @@ -27,12 +26,8 @@ public class ServerLoggerImpl implements ServerLogger { if (!showLog) { return; } - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(sender? "发送:目标--->" + from:"接收:来自--->" + to) - .append("\r\n") - .append(message); - this.stackLogger.logInfo(stringBuilder.toString()); - + String log = (sender ? "发送: 目标 => " + to : "接收: 来自 => " + from) + "\r\n" + message; + this.stackLogger.logInfo(log); } @Override @@ -40,11 +35,8 @@ public class ServerLoggerImpl implements ServerLogger { if (!showLog) { return; } - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(sender? "发送: 目标->" + from :"接收:来自->" + to) - .append("\r\n") - .append(message); - this.stackLogger.logInfo(stringBuilder.toString()); + String log = (sender ? "发送: 目标 => " + to : "接收: 来自 => " + from) + "\r\n" + message; + this.stackLogger.logInfo(log); } @Override @@ -52,11 +44,8 @@ public class ServerLoggerImpl implements ServerLogger { if (!showLog) { return; } - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(sender? "发送: 目标->" + from :"接收:来自->" + to) - .append("\r\n") - .append(message); - this.stackLogger.logInfo(stringBuilder.toString()); + String log = (sender ? "发送: 目标 => " + to : "接收: 来自 => " + from) + "\r\n" + message; + this.stackLogger.logInfo(log); } @Override @@ -84,8 +73,7 @@ public class ServerLoggerImpl implements ServerLogger { return; } if(sipStack instanceof SIPTransactionStack) { - this.sipStack = (SIPTransactionStack)sipStack; - this.stackLogger = CommonLogger.getLogger(SIPTransactionStack.class); + this.stackLogger = CommonLogger.getLogger(sipStack.getClass()); } } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java index 495722a0..5dc80dec 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java @@ -45,7 +45,7 @@ public class RecordEndEventListener implements ApplicationListener {}", handler); if (handler != null){ handler.handler(event.getRecordInfo()); - if (count == sumNum){ + if (count >= sumNum){ handlerMap.remove(deviceId + channelId); } }