2
我有一个关于ByteToMessageDecoder
的问题。该decode
方法签名ByteToMessageDecoder中的多条消息会发生什么?
public void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out)
其中out
是在管道中的下一个处理程序的输出。如果我通过多次调用out.add()
插入多条消息,下一个处理程序将看到什么?
例如,
- 管道
ByteToMessageDecoder -> SimpleChannelInboundHandler<String>
- 在
ByteToMessageDecoder
的decode
方法,我称之为out.add("first")
,out.add("second")
,out.add("third")
鉴于SimpleChannelInboundHandler
的消息处理方法有签名protected void channelRead0(ChannelHandlerContext ctx, String message)
,我会看到message
参数? channelRead0
会被称为三次吗?
我想尝试一下,发现是不可能的? –