2012-12-12 95 views
4

我的问题是关于更改已注册频道的频道的eventloop。Netty 4 - 更改频道的eventloop

通道绑定到io-eventloop线程,该线程来自serverboostrap上设置的EventLoopGroup。好。 但是,在“协议重叠”之后,我想将某些频道的io-eventloop更改为专用的io-eventloop。 所以我做这样的事情:

 channel.deregister().addListener(new ChannelFutureListener() { 

      @Override 
      public void operationComplete(ChannelFuture future) throws Exception { 

      newIoLoop.register(future.channel()).sync(); 
      } 
     }); 

所有的工作很好,但有一个问题: channel.eventloop被更新,新的ChannelHandlerContext将与此事件循环创建。 但是channel.pipeline.head仍然绑定到旧的eventloop。 这是预期的行为?

这产生()由AbstractNioByteChannel.NioByteUnsafe.read引发异常方法:

case 2: 
    // Let the inbound handler drain the buffer and continue reading. 
    if (read) { 
    read = false; 
    pipeline.fireInboundBufferUpdated(); // event fired in the pipeline to try to read some bytes but without waiting for handler executed in another loop 
    if (!byteBuf.writable()) { // byteBuf may always be full and exception is raised 
     throw new IllegalStateException(
      "an inbound handler whose buffer is full must consume at " + 
         "least one byte."); 
    } 
    } 

在我的情况,改变频道注册将解决此问题时改变pipeline.head.eventloop。

回答

0

这是一个错误..请问您可以在github上的问题跟踪器上打开一个错误报告吗?

谢谢!

+0

谢谢诺曼。 bug报告创建 – Totin

+0

只是修复...感谢报告! –