public final class FailedFuture<V> extends CompleteFuture<V>
CompleteFuture
which is failed already. It is
recommended to use EventExecutor.newFailedFuture(Throwable)
instead of calling the constructor of this future.构造器和说明 |
---|
FailedFuture(EventExecutor executor,
java.lang.Throwable cause)
Creates a new instance.
|
限定符和类型 | 方法和说明 |
---|---|
java.lang.Throwable |
cause()
Returns the cause of the failed I/O operation if the I/O operation has
failed.
|
V |
getNow()
Return the result without blocking.
|
boolean |
isSuccess()
Returns
true if and only if the I/O operation was completed
successfully. |
Future<V> |
sync()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
Future<V> |
syncUninterruptibly()
Waits for this future until it is done, and rethrows the cause of the failure if this future
failed.
|
addListener, addListeners, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cancel, executor, isCancellable, isCancelled, isDone, removeListener, removeListeners
get, get
public FailedFuture(EventExecutor executor, java.lang.Throwable cause)
executor
- the EventExecutor
associated with this futurecause
- the cause of failurepublic java.lang.Throwable cause()
Future
null
if succeeded or this future is not
completed yet.public boolean isSuccess()
Future
true
if and only if the I/O operation was completed
successfully.public Future<V> sync()
Future
sync
在类中 CompleteFuture<V>
public Future<V> syncUninterruptibly()
Future
syncUninterruptibly
在类中 CompleteFuture<V>
public V getNow()
Future
null
.
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.