我不想阻止 UI(黄金法则:)。我应该:
A) 创建 DefaultEventExecutorGroup
并在将 ChannelHandler
添加到管道时使用它:
pipeline.addLast(eventExecutorGroup, "foo", fooChannelHandler);
B) 或者在我的 ChannelHandler
实例中使用我的自定义 Java 线程池,然后在我的 messageReceived
方法中触发任务?
使用 Netty 5。
最佳答案
DefaultEventExecutorGroup 将负责确保每个 Channel 的任务以正确的顺序执行,这可能重要也可能不重要,具体取决于协议(protocol)。
关于java - 我应该使用 DefaultEventExecutorGroup 还是自定义 Java Executor?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28302530/