public interface ChannelBoundHandler
| 限定符和类型 | 方法和说明 |
|---|---|
void |
channelAdded(SocketChannel socketChannel)
连接进来
|
void |
channelClosed(SocketChannel socketChannel)
连接关闭
|
void |
channelRead(SocketChannel socketChannel,
Object obj)
消息读取
|
void |
channelWrite(SocketChannel socketChannel,
Object obj)
消息写出
|
void |
decode(SocketChannel socketChannel,
Object obj,
LinkedNonReadBlockQueue<Object> out)
消息解码
|
void |
encode(SocketChannel socketChannel,
Object obj)
消息编码
|
void |
exceptionCaught(SocketChannel socketChannel,
Throwable cause)
异常
|
void |
userEventTriggered(SocketChannel socketChannel,
IdleState evt)
该方法类似一个心态起搏器,执行读或写操作会被触发
|
void channelAdded(SocketChannel socketChannel) throws Exception
socketChannel - 通道Exception - 异常void channelClosed(SocketChannel socketChannel) throws Exception
socketChannel - 通道Exception - 异常void channelRead(SocketChannel socketChannel, Object obj) throws Exception
obj - 读取消息socketChannel - 通道Exception - 异常void channelWrite(SocketChannel socketChannel, Object obj) throws Exception
socketChannel - 通道obj - 数据Exception - 异常void exceptionCaught(SocketChannel socketChannel, Throwable cause) throws Exception
socketChannel - 通道cause - 异常信息Exception - 异常void decode(SocketChannel socketChannel, Object obj, LinkedNonReadBlockQueue<Object> out) throws Exception
socketChannel - 通道obj - 消息out - 消息队列Exception - 异常void encode(SocketChannel socketChannel, Object obj) throws Exception
socketChannel - 通道obj - 数据Exception - 异常void userEventTriggered(SocketChannel socketChannel, IdleState evt) throws Exception
socketChannel - 通道evt - IdleStateException - 异常Copyright © 2021. All rights reserved.