Class SucceededFuture<V>

All Implemented Interfaces:
Future<V>, Future<V>

public final class SucceededFuture<V> extends CompleteFuture<V>
The CompleteFuture which is succeeded already. It is recommended to use EventExecutor.newSucceededFuture(Object) instead of calling the constructor of this future.
  • Field Details

    • result

      private final V result
  • Constructor Details

    • SucceededFuture

      public SucceededFuture(EventExecutor executor, V result)
      Creates a new instance.
      Parameters:
      executor - the EventExecutor associated with this future
  • Method Details

    • cause

      public 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
      Returns true if and only if the I/O operation was completed successfully.
    • getNow

      public V getNow()
      Description copied from interface: Future
      Return the result without blocking. If the future is not done yet this will return 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.