Class ImmediateFuture<T>

  • Type Parameters:
    T - The type of return value
    All Implemented Interfaces:
    Future<T>

    public class ImmediateFuture<T>
    extends Object
    implements Future<T>
    A Future that returns immediately.
    • Constructor Detail

      • ImmediateFuture

        public ImmediateFuture()
        Creates a Future that returns null immediately
      • ImmediateFuture

        public ImmediateFuture​(T value)
        Creates a Future that returns the supplied value immediately
        Parameters:
        value - the value to return
    • 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>