Class CompleteFuture<V>

java.lang.Object
io.netty.util.concurrent.AbstractFuture<V>
io.netty.util.concurrent.CompleteFuture<V>
All Implemented Interfaces:
Future<V>, Future<V>
Direct Known Subclasses:
CompleteChannelFuture, FailedFuture, SucceededFuture

public abstract class CompleteFuture<V> extends AbstractFuture<V>
A skeletal Future implementation which represents a Future which has been completed already.
  • Field Details

  • Constructor Details

    • CompleteFuture

      protected CompleteFuture(EventExecutor executor)
      Creates a new instance.
      Parameters:
      executor - the EventExecutor associated with this future
  • Method Details

    • executor

      protected EventExecutor executor()
      Return the EventExecutor which is used by this CompleteFuture.
    • addListener

      public Future<V> addListener(GenericFutureListener<? extends Future<? super V>> listener)
      Description copied from interface: Future
      Adds the specified listener to this future. The specified listener is notified when this future is done. If this future is already completed, the specified listener is notified immediately.
    • addListeners

      public Future<V> addListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
      Description copied from interface: Future
      Adds the specified listeners to this future. The specified listeners are notified when this future is done. If this future is already completed, the specified listeners are notified immediately.
    • removeListener

      public Future<V> removeListener(GenericFutureListener<? extends Future<? super V>> listener)
      Description copied from interface: Future
      Removes the first occurrence of the specified listener from this future. The specified listener is no longer notified when this future is done. If the specified listener is not associated with this future, this method does nothing and returns silently.
    • removeListeners

      public Future<V> removeListeners(GenericFutureListener<? extends Future<? super V>>... listeners)
      Description copied from interface: Future
      Removes the first occurrence for each of the listeners from this future. The specified listeners are no longer notified when this future is done. If the specified listeners are not associated with this future, this method does nothing and returns silently.
    • await

      public Future<V> await() throws InterruptedException
      Description copied from interface: Future
      Waits for this future to be completed.
      Throws:
      InterruptedException - if the current thread was interrupted
    • await

      public boolean await(long timeout, TimeUnit unit) throws InterruptedException
      Description copied from interface: Future
      Waits for this future to be completed within the specified time limit.
      Returns:
      true if and only if the future was completed within the specified time limit
      Throws:
      InterruptedException - if the current thread was interrupted
    • sync

      public Future<V> sync() throws InterruptedException
      Description copied from interface: Future
      Waits for this future until it is done, and rethrows the cause of the failure if this future failed.
      Throws:
      InterruptedException
    • 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.
    • await

      public boolean await(long timeoutMillis) throws InterruptedException
      Description copied from interface: Future
      Waits for this future to be completed within the specified time limit.
      Returns:
      true if and only if the future was completed within the specified time limit
      Throws:
      InterruptedException - if the current thread was interrupted
    • awaitUninterruptibly

      public Future<V> awaitUninterruptibly()
      Description copied from interface: Future
      Waits for this future to be completed without interruption. This method catches an InterruptedException and discards it silently.
    • awaitUninterruptibly

      public boolean awaitUninterruptibly(long timeout, TimeUnit unit)
      Description copied from interface: Future
      Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.
      Returns:
      true if and only if the future was completed within the specified time limit
    • awaitUninterruptibly

      public boolean awaitUninterruptibly(long timeoutMillis)
      Description copied from interface: Future
      Waits for this future to be completed within the specified time limit without interruption. This method catches an InterruptedException and discards it silently.
      Returns:
      true if and only if the future was completed within the specified time limit
    • isDone

      public boolean isDone()
    • isCancellable

      public boolean isCancellable()
      Description copied from interface: Future
      returns true if and only if the operation can be cancelled via Future.cancel(boolean).
    • isCancelled

      public boolean isCancelled()
    • cancel

      public boolean cancel(boolean mayInterruptIfRunning)
      If the cancellation was successful it will fail the future with a CancellationException.
      Parameters:
      mayInterruptIfRunning - this value has no effect in this implementation.