Package com.linkedin.alpini.netty4.misc
Class ShutdownableEventLoopGroup<E extends io.netty.channel.EventLoopGroup>
java.lang.Object
com.linkedin.alpini.netty4.misc.ShutdownableEventLoopGroup<E>
- All Implemented Interfaces:
Shutdownable
,io.netty.channel.EventLoopGroup
,io.netty.util.concurrent.EventExecutorGroup
,Iterable<io.netty.util.concurrent.EventExecutor>
,Executor
,ExecutorService
,ScheduledExecutorService
public class ShutdownableEventLoopGroup<E extends io.netty.channel.EventLoopGroup>
extends Object
implements io.netty.channel.EventLoopGroup, Shutdownable
Created by acurtis on 3/30/17.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitTermination
(long timeout, TimeUnit unit) void
invokeAll
(Collection<? extends Callable<T>> tasks) invokeAll
(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) <T> T
invokeAny
(Collection<? extends Callable<T>> tasks) <T> T
invokeAny
(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) boolean
boolean
boolean
Iterator<io.netty.util.concurrent.EventExecutor>
iterator()
io.netty.channel.EventLoop
next()
io.netty.channel.ChannelFuture
register
(io.netty.channel.Channel channel) io.netty.channel.ChannelFuture
register
(io.netty.channel.ChannelPromise promise) io.netty.channel.ChannelFuture
register
(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise promise) io.netty.util.concurrent.ScheduledFuture<?>
<V> io.netty.util.concurrent.ScheduledFuture<V>
io.netty.util.concurrent.ScheduledFuture<?>
scheduleAtFixedRate
(Runnable command, long initialDelay, long period, TimeUnit unit) io.netty.util.concurrent.ScheduledFuture<?>
scheduleWithFixedDelay
(Runnable command, long initialDelay, long delay, TimeUnit unit) void
shutdown()
Starts the shutdown process.io.netty.util.concurrent.Future<?>
io.netty.util.concurrent.Future<?>
shutdownGracefully
(long quietPeriod, long timeout, TimeUnit unit) io.netty.util.concurrent.Future<?>
<T> io.netty.util.concurrent.Future<T>
<T> io.netty.util.concurrent.Future<T>
io.netty.util.concurrent.Future<?>
void
Waits for shutdown to completevoid
waitForShutdown
(long timeoutInMs) Waits for shutdown to complete with a timeoutMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ShutdownableEventLoopGroup
-
-
Method Details
-
eventLoopGroup
-
waitForShutdown
Description copied from interface:Shutdownable
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 Description copied from interface:Shutdownable
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
-
isShuttingDown
public boolean isShuttingDown()- Specified by:
isShuttingDown
in interfaceio.netty.util.concurrent.EventExecutorGroup
-
shutdownGracefully
public io.netty.util.concurrent.Future<?> shutdownGracefully()- Specified by:
shutdownGracefully
in interfaceio.netty.util.concurrent.EventExecutorGroup
-
shutdownGracefully
public io.netty.util.concurrent.Future<?> shutdownGracefully(long quietPeriod, long timeout, TimeUnit unit) - Specified by:
shutdownGracefully
in interfaceio.netty.util.concurrent.EventExecutorGroup
-
terminationFuture
public io.netty.util.concurrent.Future<?> terminationFuture()- Specified by:
terminationFuture
in interfaceio.netty.util.concurrent.EventExecutorGroup
-
shutdown
public void shutdown()Description copied from interface:Shutdownable
Starts the shutdown process. It is recommended to perform the actual shutdown activity in a separate thread from the thread that calls shutdown- Specified by:
shutdown
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
shutdown
in interfaceExecutorService
- Specified by:
shutdown
in interfaceShutdownable
-
shutdownNow
- Specified by:
shutdownNow
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
shutdownNow
in interfaceExecutorService
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdown
in interfaceExecutorService
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminated
in interfaceExecutorService
-
awaitTermination
- Specified by:
awaitTermination
in interfaceExecutorService
- Throws:
InterruptedException
-
next
public io.netty.channel.EventLoop next()- Specified by:
next
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
next
in interfaceio.netty.channel.EventLoopGroup
-
iterator
-
submit
- Specified by:
submit
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException - Specified by:
invokeAll
in interfaceExecutorService
- Throws:
InterruptedException
-
invokeAll
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException - Specified by:
invokeAll
in interfaceExecutorService
- Throws:
InterruptedException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException - Specified by:
invokeAny
in interfaceExecutorService
- Throws:
InterruptedException
ExecutionException
-
invokeAny
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
invokeAny
in interfaceExecutorService
- Throws:
InterruptedException
ExecutionException
TimeoutException
-
submit
- Specified by:
submit
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
-
submit
- Specified by:
submit
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
submit
in interfaceExecutorService
-
schedule
public io.netty.util.concurrent.ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) - Specified by:
schedule
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
schedule
in interfaceScheduledExecutorService
-
schedule
public <V> io.netty.util.concurrent.ScheduledFuture<V> schedule(Callable<V> callable, long delay, TimeUnit unit) - Specified by:
schedule
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
schedule
in interfaceScheduledExecutorService
-
scheduleAtFixedRate
public io.netty.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) - Specified by:
scheduleAtFixedRate
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
scheduleAtFixedRate
in interfaceScheduledExecutorService
-
scheduleWithFixedDelay
public io.netty.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) - Specified by:
scheduleWithFixedDelay
in interfaceio.netty.util.concurrent.EventExecutorGroup
- Specified by:
scheduleWithFixedDelay
in interfaceScheduledExecutorService
-
register
public io.netty.channel.ChannelFuture register(io.netty.channel.Channel channel) - Specified by:
register
in interfaceio.netty.channel.EventLoopGroup
-
register
public io.netty.channel.ChannelFuture register(io.netty.channel.ChannelPromise promise) - Specified by:
register
in interfaceio.netty.channel.EventLoopGroup
-
register
public io.netty.channel.ChannelFuture register(io.netty.channel.Channel channel, io.netty.channel.ChannelPromise promise) - Specified by:
register
in interfaceio.netty.channel.EventLoopGroup
-
execute
-