@UnstableApi public final class DelegatingChannelPromiseNotifier extends Object implements ChannelPromise, ChannelFutureListener
CLOSE, CLOSE_ON_FAILURE, FIRE_EXCEPTION_ON_FAILURE| Constructor and Description |
|---|
DelegatingChannelPromiseNotifier(ChannelPromise delegate) |
DelegatingChannelPromiseNotifier(ChannelPromise delegate,
boolean logNotifyFailure) |
| Modifier and Type | Method and Description |
|---|---|
ChannelPromise |
addListener(GenericFutureListener<? extends Future<? super Void>> listener)
Adds the specified listener to this future.
|
ChannelPromise |
addListeners(GenericFutureListener<? extends Future<? super Void>>... listeners)
Adds the specified listeners to this future.
|
ChannelPromise |
await()
Waits for this future to be completed.
|
boolean |
await(long timeoutMillis)
Waits for this future to be completed within the
specified time limit.
|
boolean |
await(long timeout,
TimeUnit unit)
Waits for this future to be completed within the
specified time limit.
|
ChannelPromise |
awaitUninterruptibly()
Waits for this future to be completed without
interruption.
|
boolean |
awaitUninterruptibly(long timeoutMillis)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
awaitUninterruptibly(long timeout,
TimeUnit unit)
Waits for this future to be completed within the
specified time limit without interruption.
|
boolean |
cancel(boolean mayInterruptIfRunning)
If the cancellation was successful it will fail the future with a
CancellationException. |
Throwable |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
Channel |
channel()
Returns a channel where the I/O operation associated with this
future takes place.
|
Void |
get() |
Void |
get(long timeout,
TimeUnit unit) |
Void |
getNow()
Return the result without blocking.
|
boolean |
isCancellable()
returns
true if and only if the operation can be cancelled via Future.cancel(boolean). |
boolean |
isCancelled() |
boolean |
isDone() |
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
boolean |
isVoid()
Returns
true if this ChannelFuture is a void future and so not allow to call any of the
following methods:
ChannelFuture.addListener(GenericFutureListener)
ChannelFuture.addListeners(GenericFutureListener[])
ChannelFuture.await()
Future.await(long, TimeUnit) ()}
Future.await(long) ()}
ChannelFuture.awaitUninterruptibly()
ChannelFuture.sync()
ChannelFuture.syncUninterruptibly()
|
void |
operationComplete(ChannelFuture future)
Invoked when the operation associated with the
Future has been completed. |
ChannelPromise |
removeListener(GenericFutureListener<? extends Future<? super Void>> listener)
Removes the first occurrence of the specified listener from this future.
|
ChannelPromise |
removeListeners(GenericFutureListener<? extends Future<? super Void>>... listeners)
Removes the first occurrence for each of the listeners from this future.
|
ChannelPromise |
setFailure(Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
ChannelPromise |
setSuccess() |
ChannelPromise |
setSuccess(Void result)
Marks this future as a success and notifies all
listeners.
|
boolean |
setUncancellable()
Make this future impossible to cancel.
|
ChannelPromise |
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
ChannelPromise |
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
boolean |
tryFailure(Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
boolean |
trySuccess() |
boolean |
trySuccess(Void result)
Marks this future as a success and notifies all
listeners.
|
ChannelPromise |
unvoid()
|
public DelegatingChannelPromiseNotifier(ChannelPromise delegate)
public DelegatingChannelPromiseNotifier(ChannelPromise delegate, boolean logNotifyFailure)
public void operationComplete(ChannelFuture future) throws Exception
GenericFutureListenerFuture has been completed.operationComplete in interface GenericFutureListener<ChannelFuture>future - the source Future which called this callbackExceptionpublic Channel channel()
ChannelFuturechannel in interface ChannelFuturechannel in interface ChannelPromisepublic ChannelPromise setSuccess(Void result)
PromiseIllegalStateException.setSuccess in interface ChannelPromisesetSuccess in interface Promise<Void>public ChannelPromise setSuccess()
setSuccess in interface ChannelPromisepublic boolean trySuccess()
trySuccess in interface ChannelPromisepublic boolean trySuccess(Void result)
PromisetrySuccess in interface Promise<Void>true if and only if successfully marked this future as
a success. Otherwise false because this future is
already marked as either a success or a failure.public ChannelPromise setFailure(Throwable cause)
PromiseIllegalStateException.setFailure in interface ChannelPromisesetFailure in interface Promise<Void>public ChannelPromise addListener(GenericFutureListener<? extends Future<? super Void>> listener)
FutureaddListener in interface ChannelFutureaddListener in interface ChannelPromiseaddListener in interface Promise<Void>public ChannelPromise addListeners(GenericFutureListener<? extends Future<? super Void>>... listeners)
FutureaddListeners in interface ChannelFutureaddListeners in interface ChannelPromiseaddListeners in interface Promise<Void>public ChannelPromise removeListener(GenericFutureListener<? extends Future<? super Void>> listener)
FutureremoveListener in interface ChannelFutureremoveListener in interface ChannelPromiseremoveListener in interface Promise<Void>public ChannelPromise removeListeners(GenericFutureListener<? extends Future<? super Void>>... listeners)
FutureremoveListeners in interface ChannelFutureremoveListeners in interface ChannelPromiseremoveListeners in interface Promise<Void>public boolean tryFailure(Throwable cause)
PromisetryFailure in interface Promise<Void>true if and only if successfully marked this future as
a failure. Otherwise false because this future is
already marked as either a success or a failure.public boolean setUncancellable()
PromisesetUncancellable in interface Promise<Void>true if and only if successfully marked this future as uncancellable or it is already done
without being cancelled. false if this future has been cancelled already.public ChannelPromise await() throws InterruptedException
Futureawait in interface ChannelFutureawait in interface ChannelPromiseawait in interface Promise<Void>InterruptedException - if the current thread was interruptedpublic ChannelPromise awaitUninterruptibly()
FutureInterruptedException and
discards it silently.awaitUninterruptibly in interface ChannelFutureawaitUninterruptibly in interface ChannelPromiseawaitUninterruptibly in interface Promise<Void>public boolean isVoid()
ChannelFuturetrue if this ChannelFuture is a void future and so not allow to call any of the
following methods:
isVoid in interface ChannelFuturepublic ChannelPromise unvoid()
ChannelPromiseunvoid in interface ChannelPromisepublic boolean await(long timeout,
TimeUnit unit)
throws InterruptedException
Futuretrue if and only if the future was completed within
the specified time limitInterruptedException - if the current thread was interruptedpublic boolean await(long timeoutMillis)
throws InterruptedException
Futuretrue if and only if the future was completed within
the specified time limitInterruptedException - if the current thread was interruptedpublic boolean awaitUninterruptibly(long timeout,
TimeUnit unit)
FutureInterruptedException and discards it silently.true if and only if the future was completed within
the specified time limitpublic boolean awaitUninterruptibly(long timeoutMillis)
FutureInterruptedException and discards it silently.true if and only if the future was completed within
the specified time limitpublic Void getNow()
Futurenull.
As it is possible that a null value is used to mark the future as successful you also need to check
if the future is really done with Future.isDone() and not rely on the returned null value.
public boolean cancel(boolean mayInterruptIfRunning)
FutureCancellationException.public boolean isCancelled()
isCancelled in interface Future<Void>public Void get() throws InterruptedException, ExecutionException
get in interface Future<Void>InterruptedExceptionExecutionExceptionpublic Void get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
get in interface Future<Void>InterruptedExceptionExecutionExceptionTimeoutExceptionpublic ChannelPromise sync() throws InterruptedException
Futuresync in interface ChannelFuturesync in interface ChannelPromisesync in interface Promise<Void>InterruptedExceptionpublic ChannelPromise syncUninterruptibly()
FuturesyncUninterruptibly in interface ChannelFuturesyncUninterruptibly in interface ChannelPromisesyncUninterruptibly in interface Promise<Void>public boolean isSuccess()
Futuretrue if and only if the I/O operation was completed
successfully.public boolean isCancellable()
Futuretrue if and only if the operation can be cancelled via Future.cancel(boolean).Copyright © 2008–2025 The Netty Project. All rights reserved.