优化级联注册稳定性

This commit is contained in:
648540858
2022-11-17 18:09:28 +08:00
parent 23710f1c64
commit 6b8ecd1f9d
7 changed files with 29 additions and 37 deletions

View File

@@ -5,11 +5,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @description: 录像查询结束事件
@@ -22,13 +20,12 @@ public class RecordEndEventListener implements ApplicationListener<RecordEndEven
private final static Logger logger = LoggerFactory.getLogger(RecordEndEventListener.class);
private static Map<String, SseEmitter> sseEmitters = new Hashtable<>();
public interface RecordEndEventHandler{
void handler(RecordInfo recordInfo);
}
private Map<String, RecordEndEventHandler> handlerMap = new HashMap<>();
private Map<String, RecordEndEventHandler> handlerMap = new ConcurrentHashMap<>();
@Override
public void onApplicationEvent(RecordEndEvent event) {
logger.info("录像查询完成事件触发deviceId{}, channelId: {}, 录像数量{}条", event.getRecordInfo().getDeviceId(),
@@ -38,7 +35,6 @@ public class RecordEndEventListener implements ApplicationListener<RecordEndEven
recordEndEventHandler.handler(event.getRecordInfo());
}
}
}
public void addEndEventHandler(String device, String channelId, RecordEndEventHandler recordEndEventHandler) {

View File

@@ -100,7 +100,7 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract {
if (platformRegisterInfo.isRegister()) {
platformService.online(parentPlatform);
}else {
platformService.offline(parentPlatform);
platformService.offline(parentPlatform, false);
}
// 注册/注销成功移除缓存的信息