作者 crossoverJie

:art: Improving structure / format of the code.

package com.crossoverjie.cim.client.handle;
import com.crossoverjie.cim.client.thread.HeartBeatJob;
import com.crossoverjie.cim.client.util.SpringBeanFactory;
import com.crossoverjie.cim.common.constant.Constants;
import com.crossoverjie.cim.common.protocol.CIMRequestProto;
... ... @@ -17,7 +16,6 @@ import org.slf4j.LoggerFactory;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Function:
... ... @@ -88,7 +86,7 @@ public class CIMClientHandle extends SimpleChannelInboundHandler<CIMResponseProt
}
scheduledExecutorService.scheduleAtFixedRate(new HeartBeatJob(ctx),60,60, TimeUnit.SECONDS) ;
//scheduledExecutorService.scheduleAtFixedRate(new HeartBeatJob(ctx),60,60, TimeUnit.SECONDS) ;
}
... ...
... ... @@ -61,6 +61,8 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto
IdleStateEvent idleStateEvent = (IdleStateEvent) evt;
if (idleStateEvent.state() == IdleState.READER_IDLE) {
LOGGER.info("服务端没有收到消息,向客户端发送心跳!");
//向客户端发送消息
CIMRequestProto.CIMReqProtocol heartBeat = SpringBeanFactory.getBean("heartBeat",
CIMRequestProto.CIMReqProtocol.class);
... ...