Package com.linkedin.alpini.netty4.misc
Class ShutdownableNioEventLoopGroup
java.lang.Object
io.netty.util.concurrent.AbstractEventExecutorGroup
io.netty.util.concurrent.MultithreadEventExecutorGroup
io.netty.channel.MultithreadEventLoopGroup
io.netty.channel.nio.NioEventLoopGroup
com.linkedin.alpini.netty4.misc.ShutdownableNioEventLoopGroup
- All Implemented Interfaces:
Shutdownable
,io.netty.channel.EventLoopGroup
,io.netty.util.concurrent.EventExecutorGroup
,Iterable<io.netty.util.concurrent.EventExecutor>
,Executor
,ExecutorService
,ScheduledExecutorService
public class ShutdownableNioEventLoopGroup
extends io.netty.channel.nio.NioEventLoopGroup
implements Shutdownable
-
Constructor Summary
ConstructorDescriptionCreate a new instance using the default number of threads, the defaultThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.ShutdownableNioEventLoopGroup
(int nThreads) Create a new instance using the specified number of threads,ThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.ShutdownableNioEventLoopGroup
(int nThreads, Executor executor) ShutdownableNioEventLoopGroup
(int nThreads, Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory) ShutdownableNioEventLoopGroup
(int nThreads, Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler) ShutdownableNioEventLoopGroup
(int nThreads, Executor executor, SelectorProvider selectorProvider) ShutdownableNioEventLoopGroup
(int nThreads, Executor executor, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory) ShutdownableNioEventLoopGroup
(int nThreads, ThreadFactory threadFactory) Create a new instance using the specified number of threads, the givenThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.ShutdownableNioEventLoopGroup
(int nThreads, ThreadFactory threadFactory, SelectorProvider selectorProvider) Create a new instance using the specified number of threads, the givenThreadFactory
and the givenSelectorProvider
.ShutdownableNioEventLoopGroup
(int nThreads, ThreadFactory threadFactory, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Waits for shutdown to completevoid
waitForShutdown
(long timeoutInMs) Waits for shutdown to complete with a timeoutMethods inherited from class io.netty.channel.nio.NioEventLoopGroup
newChild, rebuildSelectors, setIoRatio
Methods inherited from class io.netty.channel.MultithreadEventLoopGroup
newDefaultThreadFactory, next, register, register, register
Methods inherited from class io.netty.util.concurrent.MultithreadEventExecutorGroup
awaitTermination, executorCount, isShutdown, isShuttingDown, isTerminated, iterator, shutdown, shutdownGracefully, terminationFuture
Methods inherited from class io.netty.util.concurrent.AbstractEventExecutorGroup
execute, invokeAll, invokeAll, invokeAny, invokeAny, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdownGracefully, shutdownNow, submit, submit, submit
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.util.concurrent.EventExecutorGroup
isShuttingDown, iterator, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, shutdown, shutdownGracefully, shutdownGracefully, shutdownNow, submit, submit, submit, terminationFuture
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.linkedin.alpini.base.registry.Shutdownable
shutdown
-
Constructor Details
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup()Create a new instance using the default number of threads, the defaultThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
. -
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads) Create a new instance using the specified number of threads,ThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.- Parameters:
nThreads
-
-
ShutdownableNioEventLoopGroup
Create a new instance using the specified number of threads, the givenThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.- Parameters:
nThreads
-threadFactory
-
-
ShutdownableNioEventLoopGroup
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, ThreadFactory threadFactory, SelectorProvider selectorProvider) Create a new instance using the specified number of threads, the givenThreadFactory
and the givenSelectorProvider
.- Parameters:
nThreads
-threadFactory
-selectorProvider
-
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, ThreadFactory threadFactory, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory) -
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, Executor executor, SelectorProvider selectorProvider) -
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, Executor executor, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory) -
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory) -
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
-
-
Method Details
-
waitForShutdown
Waits for shutdown to complete- Specified by:
waitForShutdown
in interfaceShutdownable
- Throws:
InterruptedException
- when the wait is interruptedIllegalStateException
- when the method is invoked when the shutdown has yet to be started
-
waitForShutdown
public void waitForShutdown(long timeoutInMs) throws InterruptedException, IllegalStateException, TimeoutException Waits for shutdown to complete with a timeout- Specified by:
waitForShutdown
in interfaceShutdownable
- Parameters:
timeoutInMs
- number of milliseconds to wait before throwing TimeoutException- Throws:
InterruptedException
- when the wait is interruptedIllegalStateException
- when the method is invoked when the shutdown has yet to be startedTimeoutException
- when the operation times out
-