Netty 服务器引导释放陷入循环的外部资源

Netty 服务器引导释放陷入循环的外部资源,netty,Netty,我的问题似乎与以下方面有关: 我正在尝试停止我的Netty服务器,但此呼叫从未返回: serverBootstrap.releaseExternalResources(); 尝试关闭工作线程池Executor时,它将在ExecutorUtil.terminate方法中永远循环: org.jboss.netty.util.internal.ExecutorUtil.terminate() for (;;) { es.shutdownNow(); es.awa

我的问题似乎与以下方面有关:

我正在尝试停止我的Netty服务器,但此呼叫从未返回:

serverBootstrap.releaseExternalResources();
尝试关闭工作线程池Executor时,它将在ExecutorUtil.terminate方法中永远循环:

org.jboss.netty.util.internal.ExecutorUtil.terminate()
   for (;;) {
       es.shutdownNow(); 
       es.awaitTermination..
   }

问题是我无法控制连接到服务器的客户端。服务器是否有办法强制服务器停止并简单地关闭频道和停止工作线程?

在执行释放之前,您可以做些什么来确保您的子频道已关闭AllResources是将所有创建的子频道注册到。关机时,您可以调用ChannelGroup,这将关闭其中的所有频道。

根据以下信息,我个人错过的关键部分是:


换句话说,您还必须重写处理程序中的方法。

您确定没有尝试使用工作线程停止服务器?是,正常停止。相信这是因为客户端仍然有一个通向我的服务器的通道,所以我无法释放资源?有办法吗?
 public class MyHandler extends SimpleChannelUpstreamHandler {
     @Override
     public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) {
         // Add all open channels to the global group so that they are
         // closed on shutdown.
         allChannels.add(e.getChannel());
     }
 }