2013-03-04 66 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