From e97cb12b2455ab0b1b0ff09f25c370d18ed57a1b Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 3 Sep 2021 18:21:46 +0200 Subject: [PATCH] Remove deprecated EventLoopGroups (#11648) Motivation: The way how an EventLoopGroup is created for a specific transport has changed. We should remove all the old deprecated implementations and change all our code to use the new way how to init groups Modifications: - Remove LocalEventLoopGroup, NioEventLoopGroup, EpollEventLoopGroup and KQueueEventLoopGroup - Adjust code to use the new way how to setup EventLoopGroups Result: Remove deprecate classes and usages --- .../handler/pcap/PcapWriteHandlerTest.java | 6 +- .../dns/DnsAddressResolverGroupTest.java | 5 +- .../testsuite/svm/client/DnsNativeClient.java | 6 +- .../netty/testsuite/svm/HttpNativeServer.java | 7 +- .../channel/epoll/EpollEventLoopGroup.java | 108 ---------------- .../epoll/EpollDatagramUnicastTest.java | 17 ++- .../channel/kqueue/KQueueEventLoopGroup.java | 115 ------------------ .../channel/local/LocalEventLoopGroup.java | 93 -------------- .../netty/channel/nio/NioEventLoopGroup.java | 88 -------------- .../netty/channel/local/LocalChannelTest.java | 2 +- 10 files changed, 24 insertions(+), 423 deletions(-) delete mode 100644 transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoopGroup.java delete mode 100644 transport-native-kqueue/src/main/java/io/netty/channel/kqueue/KQueueEventLoopGroup.java delete mode 100644 transport/src/main/java/io/netty/channel/local/LocalEventLoopGroup.java delete mode 100644 transport/src/main/java/io/netty/channel/nio/NioEventLoopGroup.java diff --git a/handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java b/handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java index a40241808f..dd0fc68dd9 100644 --- a/handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java +++ b/handler/src/test/java/io/netty/handler/pcap/PcapWriteHandlerTest.java @@ -22,8 +22,10 @@ import io.netty.buffer.ByteBufUtil; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.SimpleChannelInboundHandler; -import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.nio.NioHandler; import io.netty.channel.socket.DatagramPacket; import io.netty.channel.socket.nio.NioDatagramChannel; import io.netty.util.CharsetUtil; @@ -47,7 +49,7 @@ public class PcapWriteHandlerTest { InetSocketAddress srvReqAddr = new InetSocketAddress("127.0.0.1", 0); InetSocketAddress cltReqAddr = new InetSocketAddress("127.0.0.1", 0); - NioEventLoopGroup eventLoopGroup = new NioEventLoopGroup(2); + EventLoopGroup eventLoopGroup = new MultithreadEventLoopGroup(2, NioHandler.newFactory()); // We'll bootstrap a UDP Server to avoid "Network Unreachable errors" when sending UDP Packet. Bootstrap server = new Bootstrap() diff --git a/resolver-dns/src/test/java/io/netty/resolver/dns/DnsAddressResolverGroupTest.java b/resolver-dns/src/test/java/io/netty/resolver/dns/DnsAddressResolverGroupTest.java index 0d25410e08..d9540a56ab 100644 --- a/resolver-dns/src/test/java/io/netty/resolver/dns/DnsAddressResolverGroupTest.java +++ b/resolver-dns/src/test/java/io/netty/resolver/dns/DnsAddressResolverGroupTest.java @@ -16,9 +16,10 @@ package io.netty.resolver.dns; import io.netty.channel.EventLoop; +import io.netty.channel.EventLoopGroup; import io.netty.channel.MultithreadEventLoopGroup; import io.netty.channel.local.LocalHandler; -import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.nio.NioHandler; import io.netty.channel.socket.nio.NioDatagramChannel; import io.netty.resolver.AddressResolver; import io.netty.util.concurrent.Promise; @@ -34,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; public class DnsAddressResolverGroupTest { @Test public void testUseConfiguredEventLoop() throws InterruptedException { - NioEventLoopGroup group = new NioEventLoopGroup(1); + EventLoopGroup group = new MultithreadEventLoopGroup(1, NioHandler.newFactory()); final EventLoop loop = group.next(); MultithreadEventLoopGroup defaultEventLoopGroup = new MultithreadEventLoopGroup(1, LocalHandler.newFactory()); DnsNameResolverBuilder builder = new DnsNameResolverBuilder() diff --git a/testsuite-native-image-client/src/main/java/io/netty/testsuite/svm/client/DnsNativeClient.java b/testsuite-native-image-client/src/main/java/io/netty/testsuite/svm/client/DnsNativeClient.java index afbbd61eb1..23d8d2b159 100644 --- a/testsuite-native-image-client/src/main/java/io/netty/testsuite/svm/client/DnsNativeClient.java +++ b/testsuite-native-image-client/src/main/java/io/netty/testsuite/svm/client/DnsNativeClient.java @@ -15,7 +15,8 @@ */ package io.netty.testsuite.svm.client; -import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.MultithreadEventLoopGroup; +import io.netty.channel.nio.NioHandler; import io.netty.channel.socket.nio.NioDatagramChannel; import io.netty.resolver.AddressResolver; import io.netty.resolver.dns.DnsAddressResolverGroup; @@ -35,7 +36,8 @@ public final class DnsNativeClient { } public static void main(String[] args) throws Exception { - NioEventLoopGroup group = new NioEventLoopGroup(1, new DefaultThreadFactory("netty")); + MultithreadEventLoopGroup group = new MultithreadEventLoopGroup( + 1, new DefaultThreadFactory("netty"), NioHandler.newFactory()); DnsAddressResolverGroup resolverGroup = new DnsAddressResolverGroup(NioDatagramChannel.class, DnsServerAddressStreamProviders.platformDefault()); diff --git a/testsuite-native-image/src/main/java/io/netty/testsuite/svm/HttpNativeServer.java b/testsuite-native-image/src/main/java/io/netty/testsuite/svm/HttpNativeServer.java index 8295edcabb..b03ca0ac83 100644 --- a/testsuite-native-image/src/main/java/io/netty/testsuite/svm/HttpNativeServer.java +++ b/testsuite-native-image/src/main/java/io/netty/testsuite/svm/HttpNativeServer.java @@ -19,7 +19,8 @@ import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; -import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.MultithreadEventLoopGroup; +import io.netty.channel.nio.NioHandler; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.logging.LogLevel; import io.netty.handler.logging.LoggingHandler; @@ -38,8 +39,8 @@ public final class HttpNativeServer { public static void main(String[] args) throws Exception { // Configure the server. - EventLoopGroup bossGroup = new NioEventLoopGroup(1); - EventLoopGroup workerGroup = new NioEventLoopGroup(); + EventLoopGroup bossGroup = new MultithreadEventLoopGroup(1, NioHandler.newFactory()); + EventLoopGroup workerGroup = new MultithreadEventLoopGroup(NioHandler.newFactory()); // Control status. boolean serverStartSucess = false; try { diff --git a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoopGroup.java b/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoopGroup.java deleted file mode 100644 index a4892b82e0..0000000000 --- a/transport-native-epoll/src/main/java/io/netty/channel/epoll/EpollEventLoopGroup.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2014 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.epoll; - -import io.netty.channel.EventLoopGroup; -import io.netty.channel.DefaultSelectStrategyFactory; -import io.netty.channel.MultithreadEventLoopGroup; -import io.netty.channel.SelectStrategyFactory; - -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadFactory; - -/** - * {@link EventLoopGroup} which uses epoll under the covers. Because of this - * it only works on linux. - * - * @deprecated use {@link MultithreadEventLoopGroup} together with {@link EpollHandler}. - */ -@Deprecated -public final class EpollEventLoopGroup extends MultithreadEventLoopGroup { - { - // Ensure JNI is initialized by the time this class is loaded. - Epoll.ensureAvailability(); - } - - /** - * Create a new instance using the default number of threads and the default {@link ThreadFactory}. - */ - public EpollEventLoopGroup() { - this(0); - } - - /** - * Create a new instance using the specified number of threads and the default {@link ThreadFactory}. - */ - public EpollEventLoopGroup(int nThreads) { - this(nThreads, (ThreadFactory) null); - } - - /** - * Create a new instance using the specified number of threads and the default {@link ThreadFactory}. - */ - @SuppressWarnings("deprecation") - public EpollEventLoopGroup(int nThreads, SelectStrategyFactory selectStrategyFactory) { - this(nThreads, (ThreadFactory) null, selectStrategyFactory); - } - - /** - * Create a new instance using the specified number of threads and the given {@link ThreadFactory}. - */ - @SuppressWarnings("deprecation") - public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory) { - this(nThreads, threadFactory, 0); - } - - public EpollEventLoopGroup(int nThreads, Executor executor) { - this(nThreads, executor, DefaultSelectStrategyFactory.INSTANCE); - } - - /** - * Create a new instance using the specified number of threads and the given {@link ThreadFactory}. - */ - @SuppressWarnings("deprecation") - public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, SelectStrategyFactory selectStrategyFactory) { - this(nThreads, threadFactory, 0, selectStrategyFactory); - } - - /** - * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the given - * maximal amount of epoll events to handle per epollWait(...). - * - * @deprecated Use {@link #EpollEventLoopGroup(int)} or {@link #EpollEventLoopGroup(int, ThreadFactory)} - */ - @Deprecated - public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce) { - this(nThreads, threadFactory, maxEventsAtOnce, DefaultSelectStrategyFactory.INSTANCE); - } - - /** - * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the given - * maximal amount of epoll events to handle per epollWait(...). - * - * @deprecated Use {@link #EpollEventLoopGroup(int)}, {@link #EpollEventLoopGroup(int, ThreadFactory)}, or - * {@link #EpollEventLoopGroup(int, SelectStrategyFactory)} - */ - @Deprecated - public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce, - SelectStrategyFactory selectStrategyFactory) { - super(nThreads, threadFactory, EpollHandler.newFactory(maxEventsAtOnce, selectStrategyFactory)); - } - - public EpollEventLoopGroup(int nThreads, Executor executor, SelectStrategyFactory selectStrategyFactory) { - super(nThreads, executor, EpollHandler.newFactory(0, selectStrategyFactory)); - } -} diff --git a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramUnicastTest.java b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramUnicastTest.java index 55b2da270e..82fd2f9f2d 100644 --- a/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramUnicastTest.java +++ b/transport-native-epoll/src/test/java/io/netty/channel/epoll/EpollDatagramUnicastTest.java @@ -93,14 +93,6 @@ public class EpollDatagramUnicastTest extends DatagramUnicastInetTest { private void testSegmentedDatagramPacket(Bootstrap sb, Bootstrap cb, boolean composite, boolean gro) throws Throwable { - if (!(cb.config().group() instanceof EpollEventLoopGroup)) { - // Only supported for the native epoll transport. - return; - } - if (gro && !(sb.config().group() instanceof EpollEventLoopGroup)) { - // Only supported for the native epoll transport. - return; - } assumeTrue(EpollDatagramChannel.isSegmentedDatagramPacketSupported()); Channel sc = null; Channel cc = null; @@ -114,7 +106,10 @@ public class EpollDatagramUnicastTest extends DatagramUnicastInetTest { }); cc = cb.bind(newSocketAddress()).get(); - + if (!(cc instanceof EpollDatagramChannel)) { + // Only supported for the native epoll transport. + return; + } final int numBuffers = 16; final int segmentSize = 512; int bufferCapacity = numBuffers * segmentSize; @@ -135,6 +130,10 @@ public class EpollDatagramUnicastTest extends DatagramUnicastInetTest { } }).bind(newSocketAddress()).get(); + if (gro && !(sc instanceof EpollDatagramChannel)) { + // Only supported for the native epoll transport. + return; + } if (sc instanceof EpollDatagramChannel) { assertEquals(gro, sc.config().getOption(EpollChannelOption.UDP_GRO)); } diff --git a/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/KQueueEventLoopGroup.java b/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/KQueueEventLoopGroup.java deleted file mode 100644 index 4027e65c4c..0000000000 --- a/transport-native-kqueue/src/main/java/io/netty/channel/kqueue/KQueueEventLoopGroup.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2016 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.kqueue; - -import io.netty.channel.DefaultSelectStrategyFactory; -import io.netty.channel.MultithreadEventLoopGroup; -import io.netty.channel.SelectStrategyFactory; -import io.netty.util.concurrent.RejectedExecutionHandler; -import io.netty.util.internal.UnstableApi; - -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadFactory; - -/** - * @deprecated use {@link MultithreadEventLoopGroup} together with {@link KQueueHandler}. - */ -@Deprecated -@UnstableApi -public final class KQueueEventLoopGroup extends MultithreadEventLoopGroup { - { - // Ensure JNI is initialized by the time this class is loaded by this time! - KQueue.ensureAvailability(); - } - /** - * Create a new instance using the default number of threads and the default {@link ThreadFactory}. - */ - public KQueueEventLoopGroup() { - this(0); - } - - /** - * Create a new instance using the specified number of threads and the default {@link ThreadFactory}. - */ - public KQueueEventLoopGroup(int nThreads) { - this(nThreads, (ThreadFactory) null); - } - - /** - * Create a new instance using the specified number of threads and the default {@link ThreadFactory}. - */ - @SuppressWarnings("deprecation") - public KQueueEventLoopGroup(int nThreads, SelectStrategyFactory selectStrategyFactory) { - this(nThreads, (ThreadFactory) null, selectStrategyFactory); - } - - /** - * Create a new instance using the specified number of threads and the given {@link ThreadFactory}. - */ - @SuppressWarnings("deprecation") - public KQueueEventLoopGroup(int nThreads, ThreadFactory threadFactory) { - this(nThreads, threadFactory, 0); - } - - public KQueueEventLoopGroup(int nThreads, Executor executor) { - this(nThreads, executor, DefaultSelectStrategyFactory.INSTANCE); - } - - /** - * Create a new instance using the specified number of threads and the given {@link ThreadFactory}. - */ - @SuppressWarnings("deprecation") - public KQueueEventLoopGroup(int nThreads, ThreadFactory threadFactory, - SelectStrategyFactory selectStrategyFactory) { - this(nThreads, threadFactory, 0, selectStrategyFactory); - } - - /** - * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the given - * maximal amount of epoll events to handle per epollWait(...). - * - * @deprecated Use {@link #KQueueEventLoopGroup(int)} or {@link #KQueueEventLoopGroup(int, ThreadFactory)} - */ - @Deprecated - public KQueueEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce) { - this(nThreads, threadFactory, maxEventsAtOnce, DefaultSelectStrategyFactory.INSTANCE); - } - - /** - * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the given - * maximal amount of epoll events to handle per epollWait(...). - * - * @deprecated Use {@link #KQueueEventLoopGroup(int)}, {@link #KQueueEventLoopGroup(int, ThreadFactory)}, or - * {@link #KQueueEventLoopGroup(int, SelectStrategyFactory)} - */ - @Deprecated - public KQueueEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce, - SelectStrategyFactory selectStrategyFactory) { - super(nThreads, threadFactory, KQueueHandler.newFactory(maxEventsAtOnce, selectStrategyFactory)); - } - - public KQueueEventLoopGroup(int nThreads, Executor executor, SelectStrategyFactory selectStrategyFactory) { - super(nThreads, executor, KQueueHandler.newFactory(0, selectStrategyFactory)); - } - - public KQueueEventLoopGroup(int nThreads, Executor executor, - SelectStrategyFactory selectStrategyFactory, - int maxTasks, - RejectedExecutionHandler rejectedExecutionHandler) { - super(nThreads, executor, KQueueHandler.newFactory(0, selectStrategyFactory), - maxTasks, rejectedExecutionHandler); - } -} diff --git a/transport/src/main/java/io/netty/channel/local/LocalEventLoopGroup.java b/transport/src/main/java/io/netty/channel/local/LocalEventLoopGroup.java deleted file mode 100644 index 88eaa21ba7..0000000000 --- a/transport/src/main/java/io/netty/channel/local/LocalEventLoopGroup.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2012 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.local; - -import io.netty.channel.MultithreadEventLoopGroup; -import io.netty.util.concurrent.RejectedExecutionHandler; - -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadFactory; - -/** - * {@link MultithreadEventLoopGroup} which must be used for the local transport. - * - * @deprecated use {@link MultithreadEventLoopGroup} together with {@link LocalHandler}. - */ -@Deprecated -public class LocalEventLoopGroup extends MultithreadEventLoopGroup { - - /** - * Create a new instance with the default number of threads. - */ - public LocalEventLoopGroup() { - this(0); - } - - /** - * Create a new instance - * - * @param nThreads the number of threads to use - */ - public LocalEventLoopGroup(int nThreads) { - this(nThreads, (ThreadFactory) null); - } - - /** - * Create a new instance - * - * @param nThreads the number of threads to use - * @param threadFactory the {@link ThreadFactory} or {@code null} to use the default - * @param maxPendingTasks the maximum number of pending tasks before new tasks will be rejected. - * @param rejectedHandler the {@link RejectedExecutionHandler} to use. - */ - public LocalEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxPendingTasks, - RejectedExecutionHandler rejectedHandler) { - super(nThreads, threadFactory, LocalHandler.newFactory(), maxPendingTasks, rejectedHandler); - } - - /** - * Create a new instance - * - * @param nThreads the number of threads to use - * @param executor the Executor to use, or {@code null} if the default should be used. - * @param maxPendingTasks the maximum number of pending tasks before new tasks will be rejected. - * @param rejectedHandler the {@link RejectedExecutionHandler} to use. - */ - public LocalEventLoopGroup(int nThreads, Executor executor, int maxPendingTasks, - RejectedExecutionHandler rejectedHandler) { - super(nThreads, executor, LocalHandler.newFactory(), maxPendingTasks, rejectedHandler); - } - - /** - * Create a new instance - * - * @param nThreads the number of threads to use - * @param threadFactory the {@link ThreadFactory} or {@code null} to use the default - */ - public LocalEventLoopGroup(int nThreads, ThreadFactory threadFactory) { - super(nThreads, threadFactory, LocalHandler.newFactory()); - } - - /** - * Create a new instance - * - * @param nThreads the number of threads to use - * @param executor the Executor to use, or {@code null} if the default should be used. - */ - public LocalEventLoopGroup(int nThreads, Executor executor) { - super(nThreads, executor, LocalHandler.newFactory()); - } -} diff --git a/transport/src/main/java/io/netty/channel/nio/NioEventLoopGroup.java b/transport/src/main/java/io/netty/channel/nio/NioEventLoopGroup.java deleted file mode 100644 index a6c81612d3..0000000000 --- a/transport/src/main/java/io/netty/channel/nio/NioEventLoopGroup.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2012 The Netty Project - * - * The Netty Project licenses this file to you under the Apache License, - * version 2.0 (the "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at: - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - */ -package io.netty.channel.nio; - -import io.netty.channel.Channel; -import io.netty.channel.DefaultSelectStrategyFactory; -import io.netty.channel.MultithreadEventLoopGroup; -import io.netty.channel.SelectStrategyFactory; -import io.netty.util.concurrent.RejectedExecutionHandler; - -import java.nio.channels.Selector; -import java.nio.channels.spi.SelectorProvider; -import java.util.concurrent.Executor; -import java.util.concurrent.ThreadFactory; - -/** - * {@link MultithreadEventLoopGroup} implementations which is used for NIO {@link Selector} based {@link Channel}s. - * - * @deprecated use {@link MultithreadEventLoopGroup} together with {@link NioHandler}. - */ -@Deprecated -public class NioEventLoopGroup extends MultithreadEventLoopGroup { - - /** - * Create a new instance using the default number of threads, the default {@link ThreadFactory} and - * the {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. - */ - public NioEventLoopGroup() { - this(0); - } - - /** - * Create a new instance using the specified number of threads, {@link ThreadFactory} and the - * {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. - */ - public NioEventLoopGroup(int nThreads) { - this(nThreads, (Executor) null); - } - - /** - * Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the - * {@link SelectorProvider} which is returned by {@link SelectorProvider#provider()}. - */ - public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory) { - this(nThreads, threadFactory, SelectorProvider.provider(), DefaultSelectStrategyFactory.INSTANCE); - } - - public NioEventLoopGroup(int nThreads, Executor executor) { - this(nThreads, executor, SelectorProvider.provider()); - } - - public NioEventLoopGroup(int nThreads, ThreadFactory threadFactory, - final SelectorProvider selectorProvider, final SelectStrategyFactory selectStrategyFactory) { - super(nThreads, threadFactory, NioHandler.newFactory(selectorProvider, selectStrategyFactory)); - } - - public NioEventLoopGroup( - int nThreads, Executor executor, final SelectorProvider selectorProvider) { - this(nThreads, executor, selectorProvider, DefaultSelectStrategyFactory.INSTANCE); - } - - public NioEventLoopGroup(int nThreads, Executor executor, final SelectorProvider selectorProvider, - final SelectStrategyFactory selectStrategyFactory) { - super(nThreads, executor, NioHandler.newFactory(selectorProvider, selectStrategyFactory)); - } - - public NioEventLoopGroup(int nThreads, Executor executor, - final SelectorProvider selectorProvider, - final SelectStrategyFactory selectStrategyFactory, - int maxTasks, - final RejectedExecutionHandler rejectedExecutionHandler) { - super(nThreads, executor, NioHandler.newFactory(selectorProvider, selectStrategyFactory), maxTasks, - rejectedExecutionHandler); - } -} diff --git a/transport/src/test/java/io/netty/channel/local/LocalChannelTest.java b/transport/src/test/java/io/netty/channel/local/LocalChannelTest.java index df86b27862..0b4da1d736 100644 --- a/transport/src/test/java/io/netty/channel/local/LocalChannelTest.java +++ b/transport/src/test/java/io/netty/channel/local/LocalChannelTest.java @@ -230,7 +230,7 @@ public class LocalChannelTest { @Test public void localChannelRaceCondition() throws Exception { final CountDownLatch closeLatch = new CountDownLatch(1); - final EventLoopGroup clientGroup = new LocalEventLoopGroup(1) { + final EventLoopGroup clientGroup = new MultithreadEventLoopGroup(1, LocalHandler.newFactory()) { @Override protected EventLoop newChild(