Class DoneFuture<T>

  • Type Parameters:
    T - The type of object in this Future.
    All Implemented Interfaces:
    Runnable, Future<T>, RunnableFuture<T>

    public class DoneFuture<T>
    extends Object
    implements RunnableFuture<T>
    A Future that is always done and will just yield the object that was given at creation time.
    • Constructor Detail

      • DoneFuture

        protected DoneFuture​(@Nullable
                             T payload)
    • Method Detail

      • cancel

        public boolean cancel​(boolean mayInterruptIfRunning)
        Specified by:
        cancel in interface Future<T>
      • isCancelled

        public boolean isCancelled()
        Specified by:
        isCancelled in interface Future<T>
      • isDone

        public boolean isDone()
        Specified by:
        isDone in interface Future<T>
      • get

        public T get()
        Specified by:
        get in interface Future<T>
      • get

        public T get​(long timeout,
                     TimeUnit unit)
        Specified by:
        get in interface Future<T>
      • of

        public static <T> DoneFuture<T> of​(@Nullable
                                           T result)