作者 crossoverJie

:art: Improving structure / format of the code.

1 package com.crossoverjie.cim.client.handle; 1 package com.crossoverjie.cim.client.handle;
2 2
3 -import com.crossoverjie.cim.client.thread.HeartBeatJob;  
4 import com.crossoverjie.cim.client.util.SpringBeanFactory; 3 import com.crossoverjie.cim.client.util.SpringBeanFactory;
5 import com.crossoverjie.cim.common.constant.Constants; 4 import com.crossoverjie.cim.common.constant.Constants;
6 import com.crossoverjie.cim.common.protocol.CIMRequestProto; 5 import com.crossoverjie.cim.common.protocol.CIMRequestProto;
@@ -17,7 +16,6 @@ import org.slf4j.LoggerFactory; @@ -17,7 +16,6 @@ import org.slf4j.LoggerFactory;
17 16
18 import java.util.concurrent.ScheduledExecutorService; 17 import java.util.concurrent.ScheduledExecutorService;
19 import java.util.concurrent.ThreadPoolExecutor; 18 import java.util.concurrent.ThreadPoolExecutor;
20 -import java.util.concurrent.TimeUnit;  
21 19
22 /** 20 /**
23 * Function: 21 * Function:
@@ -88,7 +86,7 @@ public class CIMClientHandle extends SimpleChannelInboundHandler<CIMResponseProt @@ -88,7 +86,7 @@ public class CIMClientHandle extends SimpleChannelInboundHandler<CIMResponseProt
88 } 86 }
89 87
90 88
91 - scheduledExecutorService.scheduleAtFixedRate(new HeartBeatJob(ctx),60,60, TimeUnit.SECONDS) ; 89 + //scheduledExecutorService.scheduleAtFixedRate(new HeartBeatJob(ctx),60,60, TimeUnit.SECONDS) ;
92 90
93 } 91 }
94 92
@@ -61,6 +61,8 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto @@ -61,6 +61,8 @@ public class CIMServerHandle extends SimpleChannelInboundHandler<CIMRequestProto
61 IdleStateEvent idleStateEvent = (IdleStateEvent) evt; 61 IdleStateEvent idleStateEvent = (IdleStateEvent) evt;
62 if (idleStateEvent.state() == IdleState.READER_IDLE) { 62 if (idleStateEvent.state() == IdleState.READER_IDLE) {
63 63
  64 + LOGGER.info("服务端没有收到消息,向客户端发送心跳!");
  65 +
64 //向客户端发送消息 66 //向客户端发送消息
65 CIMRequestProto.CIMReqProtocol heartBeat = SpringBeanFactory.getBean("heartBeat", 67 CIMRequestProto.CIMReqProtocol heartBeat = SpringBeanFactory.getBean("heartBeat",
66 CIMRequestProto.CIMReqProtocol.class); 68 CIMRequestProto.CIMReqProtocol.class);