From a3649ca243f827f78b85dbb41af2c3d7d978aa89 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期二, 27 四月 2021 15:38:00 +0800
Subject: [PATCH] 优化mysql建库脚本
---
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
index 3b7428a..a50b170 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
@@ -1,6 +1,9 @@
package com.genersoft.iot.vmp.media.zlm;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
@@ -119,4 +122,33 @@
storager.mediaOutline(app, streamId);
}
}
+
+ public void clearAllSessions() {
+ logger.info("娓呯┖鎵�鏈夊浗鏍囩浉鍏崇殑session");
+ JSONObject allSessionJSON = zlmresTfulUtils.getAllSession();
+ MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo();
+ HashSet<String> allLocalPorts = new HashSet();
+ if (allSessionJSON.getInteger("code") == 0) {
+ JSONArray data = allSessionJSON.getJSONArray("data");
+ if (data.size() > 0) {
+ for (int i = 0; i < data.size(); i++) {
+ JSONObject sessionJOSN = data.getJSONObject(i);
+ Integer local_port = sessionJOSN.getInteger("local_port");
+ if (!local_port.equals(Integer.valueOf(mediaInfo.getHttpPort())) &&
+ !local_port.equals(Integer.valueOf(mediaInfo.getHttpSSLport())) &&
+ !local_port.equals(Integer.valueOf(mediaInfo.getRtmpPort())) &&
+ !local_port.equals(Integer.valueOf(mediaInfo.getRtspPort())) &&
+ !local_port.equals(Integer.valueOf(mediaInfo.getRtspSSlport())) &&
+ !local_port.equals(Integer.valueOf(mediaInfo.getHookOnFlowReport()))){
+ allLocalPorts.add(sessionJOSN.getInteger("local_port") + "");
+ }
+ }
+ }
+ }
+ if (allLocalPorts.size() > 0) {
+ List<String> result = new ArrayList<>(allLocalPorts);
+ String localPortSStr = String.join(",", result);
+ zlmresTfulUtils.kickSessions(localPortSStr);
+ }
+ }
}
--
Gitblit v1.8.0