Created
September 6, 2014 20:16
-
-
Save buchgr/3501fd3da7d85ad300a0 to your computer and use it in GitHub Desktop.
eventloop shutdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java b/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java | |
| index c5a165c..8f7e29c 100644 | |
| --- a/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java | |
| +++ b/codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java | |
| @@ -54,7 +54,11 @@ import io.netty.util.NetUtil; | |
| import java.net.InetSocketAddress; | |
| import java.util.List; | |
| import java.util.concurrent.CountDownLatch; | |
| +import java.util.concurrent.Executor; | |
| +import java.util.concurrent.TimeUnit; | |
| +import io.netty.util.concurrent.DefaultExecutorFactory; | |
| +import io.netty.util.concurrent.Future; | |
| import org.junit.After; | |
| import org.junit.Before; | |
| import org.junit.Test; | |
| @@ -86,6 +90,10 @@ public class InboundHttp2ToHttpAdapterTest { | |
| private HttpResponseDelegator serverDelegator; | |
| private HttpResponseDelegator clientDelegator; | |
| + private static final Executor FJP1 = new DefaultExecutorFactory("boss").newExecutor(1); | |
| + private static final Executor FJP2 = new DefaultExecutorFactory("child").newExecutor(2); | |
| + private static final Executor FJP3 = new DefaultExecutorFactory("client").newExecutor(2); | |
| + | |
| @Before | |
| public void setup() throws Exception { | |
| MockitoAnnotations.initMocks(this); | |
| @@ -101,7 +109,7 @@ public class InboundHttp2ToHttpAdapterTest { | |
| sb = new ServerBootstrap(); | |
| cb = new Bootstrap(); | |
| - sb.group(new NioEventLoopGroup(), new NioEventLoopGroup()); | |
| + sb.group(new NioEventLoopGroup(2, FJP1), new NioEventLoopGroup(2, FJP2)); | |
| sb.channel(NioServerSocketChannel.class); | |
| sb.childHandler(new ChannelInitializer<Channel>() { | |
| @Override | |
| @@ -117,7 +125,7 @@ public class InboundHttp2ToHttpAdapterTest { | |
| } | |
| }); | |
| - cb.group(new NioEventLoopGroup()); | |
| + cb.group(new NioEventLoopGroup(2, FJP3)); | |
| cb.channel(NioSocketChannel.class); | |
| cb.handler(new ChannelInitializer<Channel>() { | |
| @Override | |
| @@ -143,8 +151,15 @@ public class InboundHttp2ToHttpAdapterTest { | |
| @After | |
| public void teardown() throws Exception { | |
| serverChannel.close().sync(); | |
| - sb.group().shutdownGracefully(); | |
| - cb.group().shutdownGracefully(); | |
| + | |
| + Future<?> f1 = sb.group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); | |
| + Future<?> f2 = sb.childGroup().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); | |
| + Future<?> f3 = cb.group().shutdownGracefully(0, 0, TimeUnit.MILLISECONDS); | |
| + | |
| + f1.sync(); | |
| + f2.sync(); | |
| + f3.sync(); | |
| + | |
| clientDelegator = null; | |
| serverDelegator = null; | |
| clientChannel = null; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment