public final class NettyUtils extends Object
| Modifier and Type | Field and Description | 
|---|---|
static io.netty.util.concurrent.SucceededFuture<?> | 
SUCCEEDED_FUTURE
Completed succeed future. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
static <SuccessT,PromiseT> | 
asyncPromiseNotifyingBiConsumer(BiConsumer<SuccessT,io.netty.util.concurrent.Promise<PromiseT>> successConsumer,
                               io.netty.util.concurrent.Promise<PromiseT> promise)
Creates a  
BiConsumer that notifies the promise of any failures either via the throwable passed into the BiConsumer
 or as a result of running the successConsumer. | 
static void | 
doInEventLoop(io.netty.util.concurrent.EventExecutor eventExecutor,
             Runnable runnable)
Runs a task in the given  
EventExecutor. | 
static void | 
doInEventLoop(io.netty.util.concurrent.EventExecutor eventExecutor,
             Runnable runnable,
             io.netty.util.concurrent.Promise<?> promise)
Runs a task in the given  
EventExecutor. | 
static <SuccessT,PromiseT> | 
promiseNotifyingBiConsumer(Function<SuccessT,PromiseT> successFunction,
                          io.netty.util.concurrent.Promise<PromiseT> promise)
Creates a  
BiConsumer that notifies the promise of any failures either via the Throwable passed into the
 BiConsumer of as a result of running the successFunction. | 
static <T> io.netty.util.concurrent.GenericFutureListener<io.netty.util.concurrent.Future<T>> | 
promiseNotifyingListener(io.netty.util.concurrent.Promise<T> channelPromise)
Create a  
GenericFutureListener that will notify the provided Promise on success and failure. | 
public static final io.netty.util.concurrent.SucceededFuture<?> SUCCEEDED_FUTURE
public static <SuccessT,PromiseT> BiConsumer<SuccessT,? super Throwable> promiseNotifyingBiConsumer(Function<SuccessT,PromiseT> successFunction, io.netty.util.concurrent.Promise<PromiseT> promise)
BiConsumer that notifies the promise of any failures either via the Throwable passed into the
 BiConsumer of as a result of running the successFunction.SuccessT - Success type.PromiseT - Type being fulfilled by the promise.successFunction - Function called to process the successful result and map it into the result to notify the promise
 with.promise - Promise to notify of success or failure.CompletableFuture.whenComplete(BiConsumer) method.public static <SuccessT,PromiseT> BiConsumer<SuccessT,? super Throwable> asyncPromiseNotifyingBiConsumer(BiConsumer<SuccessT,io.netty.util.concurrent.Promise<PromiseT>> successConsumer, io.netty.util.concurrent.Promise<PromiseT> promise)
BiConsumer that notifies the promise of any failures either via the throwable passed into the BiConsumer
 or as a result of running the successConsumer. This assumes that the successConsumer will notify the promise when it
 completes successfully.SuccessT - Success type.PromiseT - Type being fulfilled by the Promise.successConsumer - BiConsumer to call if the result is successful. Promise is also passed and must be notified on
 success.promise - Promise to notify.CompletableFuture.whenComplete(BiConsumer) method.public static <T> io.netty.util.concurrent.GenericFutureListener<io.netty.util.concurrent.Future<T>> promiseNotifyingListener(io.netty.util.concurrent.Promise<T> channelPromise)
GenericFutureListener that will notify the provided Promise on success and failure.channelPromise - Promise to notify.public static void doInEventLoop(io.netty.util.concurrent.EventExecutor eventExecutor,
                                 Runnable runnable)
EventExecutor. Runs immediately if the current thread is in the
 eventExecutor.eventExecutor - Executor to run task in.runnable - Task to run.public static void doInEventLoop(io.netty.util.concurrent.EventExecutor eventExecutor,
                                 Runnable runnable,
                                 io.netty.util.concurrent.Promise<?> promise)
EventExecutor. Runs immediately if the current thread is in the
 eventExecutor. Notifies the given Promise if a failure occurs.eventExecutor - Executor to run task in.runnable - Task to run.promise - Promise to notify if failure occurs.Copyright © 2019. All rights reserved.