public interface Promise<V> extends Future<V>
Future
which is writable.Modifier and Type | Method and Description |
---|---|
Promise<V> |
addListener(GenericFutureListener<? extends Future<? super V>> listener)
Adds the specified listener to this future.
|
Promise<V> |
addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Adds the specified listeners to this future.
|
Promise<V> |
await()
Waits for this future to be completed.
|
Promise<V> |
awaitUninterruptibly()
Waits for this future to be completed without
interruption.
|
Promise<V> |
removeListener(GenericFutureListener<? extends Future<? super V>> listener)
Removes the first occurrence of the specified listener from this future.
|
Promise<V> |
removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Removes the first occurrence for each of the listeners from this future.
|
Promise<V> |
setFailure(Throwable cause)
Marks this future as a failure and notifies all
listeners.
|
Promise<V> |
setSuccess(V result)
Marks this future as a success and notifies all
listeners.
|
boolean |
setUncancellable()
Make this future impossible to cancel.
|
Promise<V> |
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
Promise<V> |
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(V result)
Marks this future as a success and notifies all
listeners.
|
await, await, awaitUninterruptibly, awaitUninterruptibly, cancel, cause, getNow, isCancellable, isSuccess
get, get, isCancelled, isDone
Promise<V> setSuccess(V result)
IllegalStateException
.boolean trySuccess(V result)
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.Promise<V> setFailure(Throwable cause)
IllegalStateException
.boolean tryFailure(Throwable cause)
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.boolean setUncancellable()
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.Promise<V> addListener(GenericFutureListener<? extends Future<? super V>> listener)
Future
Promise<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Future
Promise<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener)
Future
Promise<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
Future
Promise<V> await() throws InterruptedException
Future
InterruptedException
- if the current thread was interruptedPromise<V> awaitUninterruptibly()
Future
InterruptedException
and
discards it silently.Promise<V> sync() throws InterruptedException
Future
InterruptedException
Copyright © 2008–2024 The Netty Project. All rights reserved.