From 66eda32ab97d6e94e9f274d6faa4df586c452dfb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期日, 25 六月 2023 10:18:29 +0800 Subject: [PATCH] 优化端口预占用 --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java index a0f4ab6..8904018 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZlmHttpHookSubscribe.java @@ -100,7 +100,10 @@ if (!CollectionUtils.isEmpty(entriesToRemove)) { for (Map.Entry<IHookSubscribe, ZlmHttpHookSubscribe.Event> entry : entriesToRemove) { - entries.remove(entry); + eventMap.remove(entry.getKey()); + } + if (eventMap.size() == 0) { + allSubscribes.remove(hookSubscribe.getHookType()); } } @@ -136,9 +139,9 @@ /** * 瀵硅闃呮暟鎹繘琛岃繃鏈熸竻鐞� */ - @Scheduled(cron="0 0/5 * * * ?") //姣�5鍒嗛挓鎵ц涓�娆� +// @Scheduled(cron="0 0/5 * * * ?") //姣�5鍒嗛挓鎵ц涓�娆� + @Scheduled(fixedRate = 2 * 1000) public void execute(){ - Instant instant = Instant.now().minusMillis(TimeUnit.MINUTES.toMillis(5)); int total = 0; for (HookType hookType : allSubscribes.keySet()) { -- Gitblit v1.8.0