去除冗余代码和死代码
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.offline;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.listener.KeyExpirationEventMessageListener;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -13,8 +9,6 @@ import org.springframework.stereotype.Component;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @Description:设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件
|
||||
* @author: swwheihei
|
||||
|
||||
@@ -7,6 +7,11 @@ import org.springframework.context.ApplicationEvent;
|
||||
*/
|
||||
public class PlatformKeepaliveExpireEvent extends ApplicationEvent {
|
||||
|
||||
/**
|
||||
* Add default serial version ID
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String platformGbID;
|
||||
|
||||
public PlatformKeepaliveExpireEvent(Object source) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.genersoft.iot.vmp.gb28181.event.platformKeepaliveExpire;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.PlatformRegister;
|
||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||
@@ -52,14 +51,14 @@ public class PlatformKeepaliveExpireEventLister implements ApplicationListener<P
|
||||
}
|
||||
ParentPlatform parentPlatform = storager.queryParentPlatById(event.getPlatformGbID());
|
||||
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(event.getPlatformGbID());
|
||||
parentPlatformCatch.setParentPlatform(parentPlatform);
|
||||
if (parentPlatformCatch == null) {
|
||||
return;
|
||||
}
|
||||
if (parentPlatform == null) {
|
||||
logger.debug("平台心跳到期事件事件触发,但平台已经删除!!! 平台国标ID:" + event.getPlatformGbID());
|
||||
return;
|
||||
}
|
||||
if (parentPlatformCatch == null) {
|
||||
return;
|
||||
}
|
||||
parentPlatformCatch.setParentPlatform(parentPlatform);
|
||||
// 发送心跳
|
||||
if (parentPlatformCatch.getKeepAliveReply() >= 3) {
|
||||
// 有3次未收到心跳回复, 设置平台状态为离线, 开始重新注册
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
|
||||
public class PlatformNotRegisterEvent extends ApplicationEvent {
|
||||
|
||||
/**
|
||||
* Add default serial version ID
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String platformGbID;
|
||||
|
||||
public PlatformNotRegisterEvent(Object source) {
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.event.online.OnlineEvent;
|
||||
import com.genersoft.iot.vmp.gb28181.event.online.OnlineEventListener;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
||||
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -27,11 +23,12 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
|
||||
|
||||
@Autowired
|
||||
private IVideoManagerStorager storager;
|
||||
|
||||
@Autowired
|
||||
private SIPCommanderFroPlatform sipCommanderFroPlatform;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redis;
|
||||
// @Autowired
|
||||
// private RedisUtil redis;
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(PlatformNotRegisterEvent event) {
|
||||
|
||||
Reference in New Issue
Block a user