Package io.netty.util.concurrent
Class FailedFuture<V>
- java.lang.Object
-
- io.netty.util.concurrent.AbstractFuture<V>
-
- io.netty.util.concurrent.CompleteFuture<V>
-
- io.netty.util.concurrent.FailedFuture<V>
-
- All Implemented Interfaces:
Future<V>
,java.util.concurrent.Future<V>
public final class FailedFuture<V> extends CompleteFuture<V>
TheCompleteFuture
which is failed already. It is recommended to useEventExecutor.newFailedFuture(Throwable)
instead of calling the constructor of this future.
-
-
Constructor Summary
Constructors Constructor Description FailedFuture(EventExecutor executor, java.lang.Throwable cause)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
Returnstrue
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.-
Methods inherited from class io.netty.util.concurrent.CompleteFuture
addListener, addListeners, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cancel, executor, isCancellable, isCancelled, isDone, removeListener, removeListeners
-
Methods inherited from class io.netty.util.concurrent.AbstractFuture
get, get
-
-
-
-
Constructor Detail
-
FailedFuture
public FailedFuture(EventExecutor executor, java.lang.Throwable cause)
Creates a new instance.- Parameters:
executor
- theEventExecutor
associated with this futurecause
- the cause of failure
-
-
Method Detail
-
cause
public java.lang.Throwable cause()
Description copied from interface:Future
Returns the cause of the failed I/O operation if the I/O operation has failed.- Returns:
- the cause of the failure.
null
if succeeded or this future is not completed yet.
-
isSuccess
public boolean isSuccess()
Description copied from interface:Future
Returnstrue
if and only if the I/O operation was completed successfully.
-
sync
public Future<V> sync()
Description copied from interface:Future
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
-
syncUninterruptibly
public Future<V> syncUninterruptibly()
Description copied from interface:Future
Waits for this future until it is done, and rethrows the cause of the failure if this future failed.- Specified by:
syncUninterruptibly
in interfaceFuture<V>
- Overrides:
syncUninterruptibly
in classCompleteFuture<V>
-
getNow
public V getNow()
Description copied from interface:Future
Return the result without blocking. If the future is not done yet this will returnnull
.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 withFuture.isDone()
and not rely on the returnednull
value.
-
-