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
,java.lang.Iterable<io.netty.util.concurrent.EventExecutor>
,java.util.concurrent.Executor
,java.util.concurrent.ExecutorService
,java.util.concurrent.ScheduledExecutorService
public class ShutdownableNioEventLoopGroup extends io.netty.channel.nio.NioEventLoopGroup implements Shutdownable
-
-
Constructor Summary
Constructors Constructor Description ShutdownableNioEventLoopGroup()
Create 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, java.util.concurrent.Executor executor)
ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)
ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider)
ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)
ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory)
Create a new instance using the specified number of threads, the givenThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider)
Create a new instance using the specified number of threads, the givenThreadFactory
and the givenSelectorProvider
.ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
waitForShutdown()
Waits for shutdown to completevoid
waitForShutdown(long timeoutInMs)
Waits for shutdown to complete with a timeout-
Methods 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 com.linkedin.alpini.base.registry.Shutdownable
shutdown
-
-
-
-
Constructor Detail
-
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
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory)
Create a new instance using the specified number of threads, the givenThreadFactory
and theSelectorProvider
which is returned bySelectorProvider.provider()
.- Parameters:
nThreads
-threadFactory
-
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor)
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.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, java.util.concurrent.ThreadFactory threadFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider)
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory)
-
ShutdownableNioEventLoopGroup
public ShutdownableNioEventLoopGroup(int nThreads, java.util.concurrent.Executor executor, io.netty.util.concurrent.EventExecutorChooserFactory chooserFactory, java.nio.channels.spi.SelectorProvider selectorProvider, io.netty.channel.SelectStrategyFactory selectStrategyFactory, io.netty.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
-
-
Method Detail
-
waitForShutdown
public void waitForShutdown() throws java.lang.InterruptedException, java.lang.IllegalStateException
Waits for shutdown to complete- Specified by:
waitForShutdown
in interfaceShutdownable
- Throws:
java.lang.InterruptedException
- when the wait is interruptedjava.lang.IllegalStateException
- when the method is invoked when the shutdown has yet to be started
-
waitForShutdown
public void waitForShutdown(long timeoutInMs) throws java.lang.InterruptedException, java.lang.IllegalStateException, java.util.concurrent.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:
java.lang.InterruptedException
- when the wait is interruptedjava.lang.IllegalStateException
- when the method is invoked when the shutdown has yet to be startedjava.util.concurrent.TimeoutException
- when the operation times out
-
-