If a NioEventLoopGroup
被用作workerGroup
, 之后的消息ByteToMessageDecoder
处理程序(对于单个连接)通过以下处理程序以顺序(单线程)方式处理NioEventLoop
.
是否有可能让它们在之后由另一个“工人”处理ByteToMessageDecoder
处理程序?
是的,只需添加一个ChannelHandler
具有特殊的EventExecutorGroup
to the ChannelPipeline
。例如无序线程池事件执行器 https://netty.io/4.1/api/io/netty/util/concurrent/UnorderedThreadPoolEventExecutor.html (src https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/concurrent/UnorderedThreadPoolEventExecutor.java).
所以像这样:
UnorderedThreadPoolEventExecutor executorGroup = ...;
pipeline.addLast(executorGroup, new MyChannelHandler());
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)