Commit c5a05c15df6c01602f259a49ff470fa996579b0b

Authored by lawrencehj
1 parent 88dd1aca

启动时清除先前注册上级平台的缓存

src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
... ... @@ -33,6 +33,9 @@ public class SipPlatformRunner implements CommandLineRunner {
33 33 // 设置所有平台离线
34 34 storager.outlineForAllParentPlatform();
35 35  
  36 + // 清理所有平台注册缓存
  37 + redisCatchStorage.cleanPlatformRegisterInfos();
  38 +
36 39 List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true);
37 40  
38 41 for (ParentPlatform parentPlatform : parentPlatforms) {
... ...
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
... ... @@ -81,6 +81,8 @@ public interface IRedisCatchStorage {
81 81  
82 82 void delPlatformRegisterInfo(String callId);
83 83  
  84 + void cleanPlatformRegisterInfos();
  85 +
84 86 void updateSendRTPSever(SendRtpItem sendRtpItem);
85 87  
86 88 /**
... ...
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
... ... @@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
13 13  
14 14 import java.util.*;
15 15  
  16 +@SuppressWarnings("rawtypes")
16 17 @Component
17 18 public class RedisCatchStorageImpl implements IRedisCatchStorage {
18 19  
... ... @@ -213,6 +214,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
213 214 }
214 215  
215 216 @Override
  217 + public void cleanPlatformRegisterInfos() {
  218 + List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + "*");
  219 + for (Object key : regInfos) {
  220 + redis.del(key.toString());
  221 + }
  222 + }
  223 +
  224 + @Override
216 225 public void updateSendRTPSever(SendRtpItem sendRtpItem) {
217 226 String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId();
218 227 redis.set(key, sendRtpItem);
... ...