2013-03-04 64 views
0

在使用netty 3.6时关闭我的netty应用程序时,在我的服务器和/或客户端引导程序上调用releaseExternalResources()时,进程不会终止。 (该项目使用ClientBootstrap和ServerBootstrap。在测试时,该过程在第一个被称为自举关机的过程中进入无限循环)Netty 3.5和Netty 3.6之间的Bootstrap.releaseExternalResources()是否有更改?

我可以清楚地将它归结为netty,因为它取决于只更改版本号3.5到3.6在我项目的POM中。有没有人在这种情况下提示我?

问候
马丁

编辑:我是如何创建引导程序和共享线程池这Netty的3.5下工作,不与Netty的3.6

@Test 
public void testRelease() { 

    // create bootstraps 
    final ExecutorService pool = Executors.newFixedThreadPool(2); 
    final ClientBootstrap client = new ClientBootstrap(
      new NioClientSocketChannelFactory(pool, 
        Executors.newCachedThreadPool())); 
    final ServerBootstrap server = new ServerBootstrap(
      new NioServerSocketChannelFactory(pool, 
        Executors.newCachedThreadPool())); 

    // release resources 
    System.out.println("Releasing resources - client..."); 
    client.releaseExternalResources(); 
    System.out.println("Releasing resources - server..."); 
    server.releaseExternalResources(); 
} 

回答

0

单元测试是有一些变化..但在bootstrap上调用releaseExternalResources()应该会像预期的那样关闭所有东西。如果不是这种情况,请打开一个错误报告

+0

谢谢。我可以写一个单元测试来重现问题。这个问题是开放的:https://github.com/netty/netty/issues/1120 – Martin 2013-03-05 08:27:58

+0

我注意到,也许我创建bootstraps的方式不是最好的。但是,目前我试图找到最好的方法时有点困惑。 BossPool和WorkerPool的新方法对我来说是非常重要的。 尽管这个bug,Netty 3.5支持我的弯曲解决方案,而Netty 3.6对我来说仍然是真实的。 – Martin 2013-03-05 11:01:26

+0

今天晚些时候我会研究它,敬请关注... – 2013-03-05 11:36:55