Package org.elasticsearch.http.nio
Class NettyListener
java.lang.Object
org.elasticsearch.http.nio.NettyListener
- All Implemented Interfaces:
io.netty.channel.ChannelFuture,io.netty.channel.ChannelPromise,io.netty.util.concurrent.Future<Void>,io.netty.util.concurrent.Promise<Void>,Future<Void>,BiConsumer<Void,Exception>
public class NettyListener
extends Object
implements BiConsumer<Void,Exception>, io.netty.channel.ChannelPromise
This is an
BiConsumer that interfaces with netty code. It wraps a netty promise and will
complete that promise when accept is called. It delegates the normal promise methods to the underlying
promise.-
Method Summary
Modifier and TypeMethodDescriptionvoidio.netty.channel.ChannelPromiseaddListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> listener) final io.netty.channel.ChannelPromiseaddListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>>... listeners) io.netty.channel.ChannelPromiseawait()booleanawait(long timeoutMillis) booleanio.netty.channel.ChannelPromisebooleanawaitUninterruptibly(long timeoutMillis) booleanawaitUninterruptibly(long timeout, TimeUnit unit) booleancancel(boolean mayInterruptIfRunning) cause()io.netty.channel.Channelchannel()static NettyListenerfromBiConsumer(BiConsumer<Void, Exception> biConsumer, io.netty.channel.Channel channel) static NettyListenerfromChannelPromise(io.netty.channel.ChannelPromise channelPromise) get()getNow()booleanbooleanbooleanisDone()booleanbooleanisVoid()io.netty.channel.ChannelPromiseremoveListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> listener) final io.netty.channel.ChannelPromiseremoveListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>>... listeners) io.netty.channel.ChannelPromisesetFailure(Throwable cause) io.netty.channel.ChannelPromiseio.netty.channel.ChannelPromisesetSuccess(Void result) booleanio.netty.channel.ChannelPromisesync()io.netty.channel.ChannelPromisebooleantryFailure(Throwable cause) booleanbooleantrySuccess(Void result) io.netty.channel.ChannelPromiseunvoid()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.BiConsumer
andThen
-
Method Details
-
accept
- Specified by:
acceptin interfaceBiConsumer<Void,Exception>
-
channel
public io.netty.channel.Channel channel()- Specified by:
channelin interfaceio.netty.channel.ChannelFuture- Specified by:
channelin interfaceio.netty.channel.ChannelPromise
-
setSuccess
- Specified by:
setSuccessin interfaceio.netty.channel.ChannelPromise- Specified by:
setSuccessin interfaceio.netty.util.concurrent.Promise<Void>
-
trySuccess
- Specified by:
trySuccessin interfaceio.netty.util.concurrent.Promise<Void>
-
setSuccess
public io.netty.channel.ChannelPromise setSuccess()- Specified by:
setSuccessin interfaceio.netty.channel.ChannelPromise
-
trySuccess
public boolean trySuccess()- Specified by:
trySuccessin interfaceio.netty.channel.ChannelPromise
-
setFailure
- Specified by:
setFailurein interfaceio.netty.channel.ChannelPromise- Specified by:
setFailurein interfaceio.netty.util.concurrent.Promise<Void>
-
tryFailure
- Specified by:
tryFailurein interfaceio.netty.util.concurrent.Promise<Void>
-
setUncancellable
public boolean setUncancellable()- Specified by:
setUncancellablein interfaceio.netty.util.concurrent.Promise<Void>
-
isSuccess
public boolean isSuccess()- Specified by:
isSuccessin interfaceio.netty.util.concurrent.Future<Void>
-
isCancellable
public boolean isCancellable()- Specified by:
isCancellablein interfaceio.netty.util.concurrent.Future<Void>
-
cause
- Specified by:
causein interfaceio.netty.util.concurrent.Future<Void>
-
addListener
public io.netty.channel.ChannelPromise addListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> listener) -
addListeners
@SafeVarargs public final io.netty.channel.ChannelPromise addListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>>... listeners) -
removeListener
public io.netty.channel.ChannelPromise removeListener(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>> listener) - Specified by:
removeListenerin interfaceio.netty.channel.ChannelFuture- Specified by:
removeListenerin interfaceio.netty.channel.ChannelPromise- Specified by:
removeListenerin interfaceio.netty.util.concurrent.Future<Void>- Specified by:
removeListenerin interfaceio.netty.util.concurrent.Promise<Void>
-
removeListeners
@SafeVarargs public final io.netty.channel.ChannelPromise removeListeners(io.netty.util.concurrent.GenericFutureListener<? extends io.netty.util.concurrent.Future<? super Void>>... listeners) - Specified by:
removeListenersin interfaceio.netty.channel.ChannelFuture- Specified by:
removeListenersin interfaceio.netty.channel.ChannelPromise- Specified by:
removeListenersin interfaceio.netty.util.concurrent.Future<Void>- Specified by:
removeListenersin interfaceio.netty.util.concurrent.Promise<Void>
-
sync
- Specified by:
syncin interfaceio.netty.channel.ChannelFuture- Specified by:
syncin interfaceio.netty.channel.ChannelPromise- Specified by:
syncin interfaceio.netty.util.concurrent.Future<Void>- Specified by:
syncin interfaceio.netty.util.concurrent.Promise<Void>- Throws:
InterruptedException
-
syncUninterruptibly
public io.netty.channel.ChannelPromise syncUninterruptibly()- Specified by:
syncUninterruptiblyin interfaceio.netty.channel.ChannelFuture- Specified by:
syncUninterruptiblyin interfaceio.netty.channel.ChannelPromise- Specified by:
syncUninterruptiblyin interfaceio.netty.util.concurrent.Future<Void>- Specified by:
syncUninterruptiblyin interfaceio.netty.util.concurrent.Promise<Void>
-
await
- Specified by:
awaitin interfaceio.netty.channel.ChannelFuture- Specified by:
awaitin interfaceio.netty.channel.ChannelPromise- Specified by:
awaitin interfaceio.netty.util.concurrent.Future<Void>- Specified by:
awaitin interfaceio.netty.util.concurrent.Promise<Void>- Throws:
InterruptedException
-
awaitUninterruptibly
public io.netty.channel.ChannelPromise awaitUninterruptibly()- Specified by:
awaitUninterruptiblyin interfaceio.netty.channel.ChannelFuture- Specified by:
awaitUninterruptiblyin interfaceio.netty.channel.ChannelPromise- Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Future<Void>- Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Promise<Void>
-
await
- Specified by:
awaitin interfaceio.netty.util.concurrent.Future<Void>- Throws:
InterruptedException
-
await
- Specified by:
awaitin interfaceio.netty.util.concurrent.Future<Void>- Throws:
InterruptedException
-
awaitUninterruptibly
- Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Future<Void>
-
awaitUninterruptibly
public boolean awaitUninterruptibly(long timeoutMillis) - Specified by:
awaitUninterruptiblyin interfaceio.netty.util.concurrent.Future<Void>
-
getNow
- Specified by:
getNowin interfaceio.netty.util.concurrent.Future<Void>
-
cancel
public boolean cancel(boolean mayInterruptIfRunning) -
isCancelled
public boolean isCancelled()- Specified by:
isCancelledin interfaceFuture<Void>
-
isDone
public boolean isDone() -
get
- Specified by:
getin interfaceFuture<Void>- Throws:
InterruptedExceptionExecutionException
-
get
public Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - Specified by:
getin interfaceFuture<Void>- Throws:
InterruptedExceptionExecutionExceptionTimeoutException
-
isVoid
public boolean isVoid()- Specified by:
isVoidin interfaceio.netty.channel.ChannelFuture
-
unvoid
public io.netty.channel.ChannelPromise unvoid()- Specified by:
unvoidin interfaceio.netty.channel.ChannelPromise
-
fromBiConsumer
public static NettyListener fromBiConsumer(BiConsumer<Void, Exception> biConsumer, io.netty.channel.Channel channel) -
fromChannelPromise
-