public class NettyServerHandler
extends io.netty.channel.SimpleChannelInboundHandler<cn.fyupeng.protocol.RpcRequest>
| 构造器和说明 |
|---|
NettyServerHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
cn.fyupeng.protocol.RpcRequest msg) |
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
void |
userEventTriggered(io.netty.channel.ChannelHandlerContext ctx,
Object evt)
监听 所有 客户端 发送的 心跳包
IdleState.READER_IDLE 时间内 服务端 没有 读操作(即客户端没有写操作,心跳包发送失败,失去连接)
触发方法执行,关闭 服务端 与 客户端的 通道 channel
|
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChangedensureNotSharable, handlerAdded, handlerRemoved, isSharableprotected void channelRead0(io.netty.channel.ChannelHandlerContext ctx,
cn.fyupeng.protocol.RpcRequest msg)
throws Exception
channelRead0 在类中 io.netty.channel.SimpleChannelInboundHandler<cn.fyupeng.protocol.RpcRequest>Exceptionpublic void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause)
throws Exception
exceptionCaught 在接口中 io.netty.channel.ChannelHandlerexceptionCaught 在接口中 io.netty.channel.ChannelInboundHandlerexceptionCaught 在类中 io.netty.channel.ChannelInboundHandlerAdapterExceptionpublic void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx,
Object evt)
throws Exception
userEventTriggered 在接口中 io.netty.channel.ChannelInboundHandleruserEventTriggered 在类中 io.netty.channel.ChannelInboundHandlerAdapterctx - evt - ExceptionCopyright © 2022. All rights reserved.