Class FailedFuture<V>

    • Constructor Detail

      • FailedFuture

        public FailedFuture​(EventExecutor executor,
                            java.lang.Throwable cause)
        Creates a new instance.
        Parameters:
        executor - the EventExecutor associated with this future
        cause - 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
        Returns true 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.
        Specified by:
        sync in interface Future<V>
        Overrides:
        sync in class CompleteFuture<V>
      • 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.