public class PreferCurrentEventLoopGroup
extends java.lang.Object
implements io.netty.channel.EventLoopGroup
EventLoopGroup can be used for clients that favors use of the "current" EventLoop for the
outbound connection. A current EventLoop is determined by checking if the thread calling next() is
an eventloop instance belonging to this group. If so, the same instance is returned from next() otherwise,
the call to next() is delegated to the actual EventLoopGroup passed to this instance.
This is generally useful for applications that process a received request by calling some other downstream
applications. If, during processing of these requests, there is no new thread introduced, then the EventLoop
processing the received request will also execute the outbound request to another application.
The above, although being subtle has benefits around removing queuing while writing data to any channel in the entire
request processing.| Constructor and Description |
|---|
PreferCurrentEventLoopGroup(io.netty.channel.EventLoopGroup delegate) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
execute(java.lang.Runnable command) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> java.util.List<java.util.concurrent.Future<T>> |
invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks) |
<T> T |
invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit) |
boolean |
isShutdown() |
boolean |
isShuttingDown() |
boolean |
isTerminated() |
java.util.Iterator<io.netty.util.concurrent.EventExecutor> |
iterator()
Deprecated.
|
io.netty.channel.EventLoop |
next() |
io.netty.channel.ChannelFuture |
register(io.netty.channel.Channel channel) |
io.netty.channel.ChannelFuture |
register(io.netty.channel.Channel channel,
io.netty.channel.ChannelPromise promise)
Deprecated.
|
io.netty.channel.ChannelFuture |
register(io.netty.channel.ChannelPromise promise) |
<V> io.netty.util.concurrent.ScheduledFuture<V> |
schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit) |
io.netty.util.concurrent.ScheduledFuture<?> |
schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit) |
io.netty.util.concurrent.ScheduledFuture<?> |
scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit) |
io.netty.util.concurrent.ScheduledFuture<?> |
scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit) |
void |
shutdown()
Deprecated.
|
io.netty.util.concurrent.Future<?> |
shutdownGracefully() |
io.netty.util.concurrent.Future<?> |
shutdownGracefully(long quietPeriod,
long timeout,
java.util.concurrent.TimeUnit unit) |
java.util.List<java.lang.Runnable> |
shutdownNow()
Deprecated.
|
<T> io.netty.util.concurrent.Future<T> |
submit(java.util.concurrent.Callable<T> task) |
io.netty.util.concurrent.Future<?> |
submit(java.lang.Runnable task) |
<T> io.netty.util.concurrent.Future<T> |
submit(java.lang.Runnable task,
T result) |
io.netty.util.concurrent.Future<?> |
terminationFuture() |
public PreferCurrentEventLoopGroup(io.netty.channel.EventLoopGroup delegate)
public io.netty.channel.EventLoop next()
next in interface io.netty.channel.EventLoopGroupnext in interface io.netty.util.concurrent.EventExecutorGrouppublic io.netty.channel.ChannelFuture register(io.netty.channel.Channel channel)
register in interface io.netty.channel.EventLoopGrouppublic io.netty.channel.ChannelFuture register(io.netty.channel.ChannelPromise promise)
register in interface io.netty.channel.EventLoopGroup@Deprecated
public io.netty.channel.ChannelFuture register(io.netty.channel.Channel channel,
io.netty.channel.ChannelPromise promise)
register in interface io.netty.channel.EventLoopGrouppublic boolean isShuttingDown()
isShuttingDown in interface io.netty.util.concurrent.EventExecutorGrouppublic io.netty.util.concurrent.Future<?> shutdownGracefully()
shutdownGracefully in interface io.netty.util.concurrent.EventExecutorGrouppublic io.netty.util.concurrent.Future<?> shutdownGracefully(long quietPeriod,
long timeout,
java.util.concurrent.TimeUnit unit)
shutdownGracefully in interface io.netty.util.concurrent.EventExecutorGrouppublic io.netty.util.concurrent.Future<?> terminationFuture()
terminationFuture in interface io.netty.util.concurrent.EventExecutorGroup@Deprecated public void shutdown()
shutdown in interface io.netty.util.concurrent.EventExecutorGroupshutdown in interface java.util.concurrent.ExecutorService@Deprecated public java.util.List<java.lang.Runnable> shutdownNow()
shutdownNow in interface io.netty.util.concurrent.EventExecutorGroupshutdownNow in interface java.util.concurrent.ExecutorService@Deprecated public java.util.Iterator<io.netty.util.concurrent.EventExecutor> iterator()
iterator in interface io.netty.util.concurrent.EventExecutorGroupiterator in interface java.lang.Iterable<io.netty.util.concurrent.EventExecutor>public io.netty.util.concurrent.Future<?> submit(java.lang.Runnable task)
submit in interface io.netty.util.concurrent.EventExecutorGroupsubmit in interface java.util.concurrent.ExecutorServicepublic <T> io.netty.util.concurrent.Future<T> submit(java.lang.Runnable task,
T result)
submit in interface io.netty.util.concurrent.EventExecutorGroupsubmit in interface java.util.concurrent.ExecutorServicepublic <T> io.netty.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
submit in interface io.netty.util.concurrent.EventExecutorGroupsubmit in interface java.util.concurrent.ExecutorServicepublic io.netty.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command,
long delay,
java.util.concurrent.TimeUnit unit)
schedule in interface io.netty.util.concurrent.EventExecutorGroupschedule in interface java.util.concurrent.ScheduledExecutorServicepublic <V> io.netty.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable,
long delay,
java.util.concurrent.TimeUnit unit)
schedule in interface io.netty.util.concurrent.EventExecutorGroupschedule in interface java.util.concurrent.ScheduledExecutorServicepublic io.netty.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command,
long initialDelay,
long period,
java.util.concurrent.TimeUnit unit)
scheduleAtFixedRate in interface io.netty.util.concurrent.EventExecutorGroupscheduleAtFixedRate in interface java.util.concurrent.ScheduledExecutorServicepublic io.netty.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command,
long initialDelay,
long delay,
java.util.concurrent.TimeUnit unit)
scheduleWithFixedDelay in interface io.netty.util.concurrent.EventExecutorGroupscheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorServicepublic boolean isShutdown()
isShutdown in interface java.util.concurrent.ExecutorServicepublic boolean isTerminated()
isTerminated in interface java.util.concurrent.ExecutorServicepublic boolean awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
awaitTermination in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException
invokeAll in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> java.util.List<java.util.concurrent.Future<T>> invokeAll(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
invokeAll in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException
invokeAny in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionpublic <T> T invokeAny(java.util.Collection<? extends java.util.concurrent.Callable<T>> tasks,
long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException,
java.util.concurrent.ExecutionException,
java.util.concurrent.TimeoutException
invokeAny in interface java.util.concurrent.ExecutorServicejava.lang.InterruptedExceptionjava.util.concurrent.ExecutionExceptionjava.util.concurrent.TimeoutExceptionpublic void execute(java.lang.Runnable command)
execute in interface java.util.concurrent.Executor