Package io.netty.util.concurrent
Class SucceededFuture<V>
- java.lang.Object
-
- io.netty.util.concurrent.AbstractFuture<V>
-
- io.netty.util.concurrent.CompleteFuture<V>
-
- io.netty.util.concurrent.SucceededFuture<V>
-
- All Implemented Interfaces:
Future<V>,java.util.concurrent.Future<V>
public final class SucceededFuture<V> extends CompleteFuture<V>
TheCompleteFuturewhich is succeeded already. It is recommended to useEventExecutor.newSucceededFuture(Object)instead of calling the constructor of this future.
-
-
Constructor Summary
Constructors Constructor Description SucceededFuture(EventExecutor executor, V result)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Throwablecause()Returns the cause of the failed I/O operation if the I/O operation has failed.VgetNow()Return the result without blocking.booleanisSuccess()Returnstrueif and only if the I/O operation was completed successfully.-
Methods inherited from class io.netty.util.concurrent.CompleteFuture
addListener, addListeners, await, await, await, awaitUninterruptibly, awaitUninterruptibly, awaitUninterruptibly, cancel, executor, isCancellable, isCancelled, isDone, removeListener, removeListeners, sync, syncUninterruptibly
-
Methods inherited from class io.netty.util.concurrent.AbstractFuture
get, get
-
-
-
-
Constructor Detail
-
SucceededFuture
public SucceededFuture(EventExecutor executor, V result)
Creates a new instance.- Parameters:
executor- theEventExecutorassociated with this future
-
-
Method Detail
-
cause
public java.lang.Throwable cause()
Description copied from interface:FutureReturns the cause of the failed I/O operation if the I/O operation has failed.- Returns:
- the cause of the failure.
nullif succeeded or this future is not completed yet.
-
isSuccess
public boolean isSuccess()
Description copied from interface:FutureReturnstrueif and only if the I/O operation was completed successfully.
-
getNow
public V getNow()
Description copied from interface:FutureReturn the result without blocking. If the future is not done yet this will returnnull.As it is possible that a
nullvalue 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 returnednullvalue.
-
-