GeezerVison is showing github.com — Replace usage of DefaultEventLoopGroup (#15904) · netty/netty@121e5ca
File treeExpand file treeCollapse file tree Open diff view settings codec-haproxy/src/test/java/io/netty/handler/codec/haproxy codec-http2/src/test/java/io/netty/handler/codec/http2 handler-proxy/src/test/java/io/netty/handler/proxy handler-ssl-ocsp/src/test/java/io/netty/handler/ssl/ocsp handler/src/test/java/io/netty/handler resolver-dns/src/test/java/io/netty/resolver/dns transport/src/test/java/io/netty
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: codec-haproxy/src/test/java/io/netty/handler/codec/haproxy/HAProxyIntegrationTest.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 21 | 21 | import io.netty.channel.Channel; | 22 | 22 | import io.netty.channel.ChannelHandlerContext; | 23 | 23 | import io.netty.channel.ChannelInitializer; | 24 | | -import io.netty.channel.DefaultEventLoopGroup; | 25 | 24 | import io.netty.channel.EventLoopGroup; | | 25 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 26 | 26 | import io.netty.channel.SimpleChannelInboundHandler; | 27 | 27 | import io.netty.channel.local.LocalAddress; | 28 | 28 | import io.netty.channel.local.LocalChannel; | | 29 | +import io.netty.channel.local.LocalIoHandler; | 29 | 30 | import io.netty.channel.local.LocalServerChannel; | 30 | 31 | import org.junit.jupiter.api.Test; | 31 | 32 |
| @@ -44,7 +45,7 @@ public void testBasicCase() throws Exception { | 44 | 45 | final AtomicReference<HAProxyMessage> msgHolder = new AtomicReference<HAProxyMessage>(); | 45 | 46 | LocalAddress localAddress = new LocalAddress("HAProxyIntegrationTest"); | 46 | 47 |
| 47 | | - EventLoopGroup group = new DefaultEventLoopGroup(); | | 48 | + EventLoopGroup group = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory()); | 48 | 49 | ServerBootstrap sb = new ServerBootstrap(); | 49 | 50 | sb.channel(LocalServerChannel.class) | 50 | 51 | .group(group) | |
Collapse file Copy file name to clipboardExpand all lines: codec-http2/src/test/java/io/netty/handler/codec/http2/Http2ConnectionRoundtripTest.java +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | import io.netty.channel.ChannelOutboundHandlerAdapter; | 30 | 30 | import io.netty.channel.ChannelPipeline; | 31 | 31 | import io.netty.channel.ChannelPromise; | 32 | | -import io.netty.channel.DefaultEventLoopGroup; | | 32 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 33 | 33 | import io.netty.channel.local.LocalAddress; | 34 | 34 | import io.netty.channel.local.LocalChannel; | | 35 | +import io.netty.channel.local.LocalIoHandler; | 35 | 36 | import io.netty.channel.local.LocalServerChannel; | 36 | 37 | import io.netty.handler.codec.http2.Http2TestUtil.FrameCountDown; | 37 | 38 | import io.netty.handler.codec.http2.Http2TestUtil.Http2Runnable; | @@ -1194,7 +1195,7 @@ private void bootstrapEnv(int dataCountDown, int settingsAckCount, | 1194 | 1195 |
| 1195 | 1196 | final AtomicReference<Http2ConnectionHandler> serverHandlerRef = new AtomicReference<Http2ConnectionHandler>(); | 1196 | 1197 | final CountDownLatch serverInitLatch = new CountDownLatch(1); | 1197 | | - sb.group(new DefaultEventLoopGroup()); | | 1198 | + sb.group(new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory())); | 1198 | 1199 | sb.channel(LocalServerChannel.class); | 1199 | 1200 | sb.childHandler(new ChannelInitializer<Channel>() { | 1200 | 1201 | @Override | @@ -1214,7 +1215,7 @@ protected void initChannel(Channel ch) throws Exception { | 1214 | 1215 | } | 1215 | 1216 | }); | 1216 | 1217 |
| 1217 | | - cb.group(new DefaultEventLoopGroup()); | | 1218 | + cb.group(new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory())); | 1218 | 1219 | cb.channel(LocalChannel.class); | 1219 | 1220 | cb.handler(new ChannelInitializer<Channel>() { | 1220 | 1221 | @Override | |
Collapse file Copy file name to clipboardExpand all lines: codec-http2/src/test/java/io/netty/handler/codec/http2/HttpToHttp2ConnectionHandlerTest.java +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 25 | 25 | import io.netty.channel.ChannelInitializer; | 26 | 26 | import io.netty.channel.ChannelPipeline; | 27 | 27 | import io.netty.channel.ChannelPromise; | 28 | | -import io.netty.channel.DefaultEventLoopGroup; | | 28 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 29 | 29 | import io.netty.channel.local.LocalAddress; | 30 | 30 | import io.netty.channel.local.LocalChannel; | | 31 | +import io.netty.channel.local.LocalIoHandler; | 31 | 32 | import io.netty.channel.local.LocalServerChannel; | 32 | 33 | import io.netty.handler.codec.http.DefaultFullHttpRequest; | 33 | 34 | import io.netty.handler.codec.http.DefaultHttpContent; | @@ -557,7 +558,7 @@ private void bootstrapEnv(int requestCountDown, int serverSettingsAckCount, int | 557 | 558 | sb = new ServerBootstrap(); | 558 | 559 | cb = new Bootstrap(); | 559 | 560 |
| 560 | | - sb.group(new DefaultEventLoopGroup()); | | 561 | + sb.group(new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory())); | 561 | 562 | sb.channel(LocalServerChannel.class); | 562 | 563 | sb.childHandler(new ChannelInitializer<Channel>() { | 563 | 564 | @Override | @@ -575,7 +576,7 @@ protected void initChannel(Channel ch) throws Exception { | 575 | 576 | } | 576 | 577 | }); | 577 | 578 |
| 578 | | - cb.group(new DefaultEventLoopGroup()); | | 579 | + cb.group(new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory())); | 579 | 580 | cb.channel(LocalChannel.class); | 580 | 581 | cb.handler(new ChannelInitializer<Channel>() { | 581 | 582 | @Override | |
Collapse file Copy file name to clipboardExpand all lines: codec-http2/src/test/java/io/netty/handler/codec/http2/InboundHttp2ToHttpAdapterTest.java +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 26 | 26 | import io.netty.channel.ChannelInitializer; | 27 | 27 | import io.netty.channel.ChannelPipeline; | 28 | 28 | import io.netty.channel.ChannelPromise; | 29 | | -import io.netty.channel.DefaultEventLoopGroup; | | 29 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 30 | 30 | import io.netty.channel.SimpleChannelInboundHandler; | 31 | 31 | import io.netty.channel.local.LocalAddress; | 32 | 32 | import io.netty.channel.local.LocalChannel; | | 33 | +import io.netty.channel.local.LocalIoHandler; | 33 | 34 | import io.netty.channel.local.LocalServerChannel; | 34 | 35 | import io.netty.handler.codec.http.DefaultFullHttpRequest; | 35 | 36 | import io.netty.handler.codec.http.DefaultFullHttpResponse; | @@ -669,7 +670,7 @@ private void boostrapEnv(int clientLatchCount, int clientLatchCount2, int server | 669 | 670 | sb = new ServerBootstrap(); | 670 | 671 | cb = new Bootstrap(); | 671 | 672 |
| 672 | | - sb.group(new DefaultEventLoopGroup()); | | 673 | + sb.group(new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory())); | 673 | 674 | sb.channel(LocalServerChannel.class); | 674 | 675 | sb.childHandler(new ChannelInitializer<Channel>() { | 675 | 676 | @Override | @@ -697,7 +698,7 @@ protected void initChannel(Channel ch) throws Exception { | 697 | 698 | } | 698 | 699 | }); | 699 | 700 |
| 700 | | - cb.group(new DefaultEventLoopGroup()); | | 701 | + cb.group(new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory())); | 701 | 702 | cb.channel(LocalChannel.class); | 702 | 703 | cb.handler(new ChannelInitializer<Channel>() { | 703 | 704 | @Override | |
Collapse file Copy file name to clipboardExpand all lines: handler-proxy/src/test/java/io/netty/handler/proxy/HttpProxyHandlerTest.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 23 | 23 | import io.netty.channel.ChannelInboundHandlerAdapter; | 24 | 24 | import io.netty.channel.ChannelInitializer; | 25 | 25 | import io.netty.channel.ChannelPromise; | 26 | | -import io.netty.channel.DefaultEventLoopGroup; | 27 | 26 | import io.netty.channel.EventLoopGroup; | | 27 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 28 | 28 | import io.netty.channel.embedded.EmbeddedChannel; | 29 | 29 | import io.netty.channel.local.LocalAddress; | 30 | 30 | import io.netty.channel.local.LocalChannel; | | 31 | +import io.netty.channel.local.LocalIoHandler; | 31 | 32 | import io.netty.channel.local.LocalServerChannel; | 32 | 33 | import io.netty.handler.codec.http.DefaultFullHttpResponse; | 33 | 34 | import io.netty.handler.codec.http.DefaultHttpHeaders; | @@ -181,7 +182,7 @@ public void testExceptionDuringConnect() throws Exception { | 181 | 182 | Channel serverChannel = null; | 182 | 183 | Channel clientChannel = null; | 183 | 184 | try { | 184 | | - group = new DefaultEventLoopGroup(1); | | 185 | + group = new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory()); | 185 | 186 | final LocalAddress addr = new LocalAddress("a"); | 186 | 187 | final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); | 187 | 188 | ChannelFuture sf = | |
Collapse file Copy file name to clipboardExpand all lines: handler-ssl-ocsp/src/test/java/io/netty/handler/ssl/ocsp/OcspTest.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 26 | 26 | import io.netty.channel.ChannelInboundHandlerAdapter; | 27 | 27 | import io.netty.channel.ChannelInitializer; | 28 | 28 | import io.netty.channel.ChannelPipeline; | 29 | | -import io.netty.channel.DefaultEventLoopGroup; | 30 | 29 | import io.netty.channel.EventLoopGroup; | | 30 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 31 | 31 | import io.netty.channel.local.LocalAddress; | 32 | 32 | import io.netty.channel.local.LocalChannel; | | 33 | +import io.netty.channel.local.LocalIoHandler; | 33 | 34 | import io.netty.channel.local.LocalServerChannel; | 34 | 35 | import io.netty.handler.ssl.OpenSsl; | 35 | 36 | import io.netty.handler.ssl.ReferenceCountedOpenSslEngine; | @@ -370,7 +371,7 @@ private static void handshake(SslProvider sslProvider, CountDownLatch latch, Cha | 370 | 371 | .build(); | 371 | 372 |
| 372 | 373 | try { | 373 | | - EventLoopGroup group = new DefaultEventLoopGroup(); | | 374 | + EventLoopGroup group = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory()); | 374 | 375 | try { | 375 | 376 | LocalAddress address = new LocalAddress("handshake-" + Math.random()); | 376 | 377 | Channel server = newServer(group, address, serverSslContext, response, serverHandler); | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/address/ResolveAddressHandlerTest.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 21 | 21 | import io.netty.channel.ChannelFuture; | 22 | 22 | import io.netty.channel.ChannelHandlerContext; | 23 | 23 | import io.netty.channel.ChannelInboundHandlerAdapter; | 24 | | -import io.netty.channel.DefaultEventLoopGroup; | 25 | 24 | import io.netty.channel.EventLoopGroup; | | 25 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 26 | 26 | import io.netty.channel.local.LocalAddress; | 27 | 27 | import io.netty.channel.local.LocalChannel; | | 28 | +import io.netty.channel.local.LocalIoHandler; | 28 | 29 | import io.netty.channel.local.LocalServerChannel; | 29 | 30 | import io.netty.resolver.AbstractAddressResolver; | 30 | 31 | import io.netty.resolver.AddressResolver; | @@ -55,7 +56,7 @@ public class ResolveAddressHandlerTest { | 55 | 56 |
| 56 | 57 | @BeforeAll | 57 | 58 | public static void createEventLoop() { | 58 | | - group = new DefaultEventLoopGroup(); | | 59 | + group = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory()); | 59 | 60 | } | 60 | 61 |
| 61 | 62 | @AfterAll | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/CipherSuiteCanaryTest.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 25 | 25 | import io.netty.channel.ChannelHandlerContext; | 26 | 26 | import io.netty.channel.ChannelInitializer; | 27 | 27 | import io.netty.channel.ChannelPipeline; | 28 | | -import io.netty.channel.DefaultEventLoopGroup; | 29 | 28 | import io.netty.channel.EventLoopGroup; | | 29 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 30 | 30 | import io.netty.channel.SimpleChannelInboundHandler; | 31 | 31 | import io.netty.channel.local.LocalAddress; | 32 | 32 | import io.netty.channel.local.LocalChannel; | | 33 | +import io.netty.channel.local.LocalIoHandler; | 33 | 34 | import io.netty.channel.local.LocalServerChannel; | 34 | 35 | import io.netty.handler.ssl.util.InsecureTrustManagerFactory; | 35 | 36 | import io.netty.pkitesting.CertificateBuilder; | @@ -77,7 +78,7 @@ static Collection<Object[]> parameters() { | 77 | 78 |
| 78 | 79 | @BeforeAll | 79 | 80 | public static void init() throws Exception { | 80 | | - GROUP = new DefaultEventLoopGroup(); | | 81 | + GROUP = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory()); | 81 | 82 | CERT = new CertificateBuilder() | 82 | 83 | .rsa2048() | 83 | 84 | .subject("cn=localhost") | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/OpenSslPrivateKeyMethodTest.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 25 | 25 | import io.netty.channel.ChannelHandlerContext; | 26 | 26 | import io.netty.channel.ChannelInitializer; | 27 | 27 | import io.netty.channel.ChannelPipeline; | 28 | | -import io.netty.channel.DefaultEventLoopGroup; | 29 | 28 | import io.netty.channel.EventLoopGroup; | | 29 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 30 | 30 | import io.netty.channel.SimpleChannelInboundHandler; | 31 | 31 | import io.netty.channel.local.LocalAddress; | 32 | 32 | import io.netty.channel.local.LocalChannel; | | 33 | +import io.netty.channel.local.LocalIoHandler; | 33 | 34 | import io.netty.channel.local.LocalServerChannel; | 34 | 35 | import io.netty.handler.ssl.util.InsecureTrustManagerFactory; | 35 | 36 | import io.netty.pkitesting.CertificateBuilder; | @@ -98,7 +99,7 @@ public static void init() throws Exception { | 98 | 99 | assumeCipherAvailable(SslProvider.OPENSSL); | 99 | 100 | assumeCipherAvailable(SslProvider.JDK); | 100 | 101 |
| 101 | | - GROUP = new DefaultEventLoopGroup(); | | 102 | + GROUP = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory()); | 102 | 103 | CERT = new CertificateBuilder() | 103 | 104 | .rsa2048() | 104 | 105 | .subject("cn=localhost") | |
Collapse file Copy file name to clipboardExpand all lines: handler/src/test/java/io/netty/handler/ssl/SniClientJava8TestUtil.java +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 22 | 22 | import io.netty.channel.ChannelHandlerContext; | 23 | 23 | import io.netty.channel.ChannelInboundHandlerAdapter; | 24 | 24 | import io.netty.channel.ChannelInitializer; | 25 | | -import io.netty.channel.DefaultEventLoopGroup; | 26 | 25 | import io.netty.channel.EventLoopGroup; | | 26 | +import io.netty.channel.MultiThreadIoEventLoopGroup; | 27 | 27 | import io.netty.channel.local.LocalAddress; | 28 | 28 | import io.netty.channel.local.LocalChannel; | | 29 | +import io.netty.channel.local.LocalIoHandler; | 29 | 30 | import io.netty.channel.local.LocalServerChannel; | 30 | 31 | import io.netty.handler.ssl.util.CachedSelfSignedCertificate; | 31 | 32 | import io.netty.handler.ssl.util.InsecureTrustManagerFactory; | @@ -83,7 +84,7 @@ static void testSniClient(SslProvider sslClientProvider, SslProvider sslServerPr | 83 | 84 | final String sniHost = "sni.netty.io"; | 84 | 85 | SelfSignedCertificate cert = CachedSelfSignedCertificate.getCachedCertificate(); | 85 | 86 | LocalAddress address = new LocalAddress("test"); | 86 | | - EventLoopGroup group = new DefaultEventLoopGroup(1); | | 87 | + EventLoopGroup group = new MultiThreadIoEventLoopGroup(1, LocalIoHandler.newFactory()); | 87 | 88 | SslContext sslServerContext = null; | 88 | 89 | SslContext sslClientContext = null; | 89 | 90 |
| |
|