|
@@ -6,6 +6,9 @@ import com.persagy.repository.AlarmRecordRepository;
|
|
|
import com.persagy.service.AlarmDefineService;
|
|
|
import io.netty.channel.ChannelInitializer;
|
|
|
import io.netty.channel.socket.SocketChannel;
|
|
|
+import io.netty.handler.timeout.IdleStateHandler;
|
|
|
+
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
public class CenterChannelInitializer extends ChannelInitializer<SocketChannel> {
|
|
@@ -21,6 +24,7 @@ public class CenterChannelInitializer extends ChannelInitializer<SocketChannel>
|
|
|
|
|
|
@Override
|
|
|
protected void initChannel(SocketChannel channel) throws Exception {
|
|
|
+ channel.pipeline().addLast(new IdleStateHandler(0,60,0, TimeUnit.SECONDS));
|
|
|
//对象传输处理
|
|
|
channel.pipeline().addLast(new ObjDecoder());
|
|
|
// 在管道中添加我们自己的接收数据实现方法
|