Class PromiseImpl<T>

  • Type Parameters:
    T - result type
    All Implemented Interfaces:
    Promise<T>

    final class PromiseImpl<T>
    extends java.lang.Object
    implements Promise<T>
    Internal Promise implementation.
    • Constructor Detail

    • Method Detail

      • executor

        public java.util.concurrent.Executor executor()
        Description copied from interface: Promise
        Returns the Executor used by the underlying Future of this Promise.
        Specified by:
        executor in interface Promise<T>
        Returns:
        The underlying Executor.
      • executorService

        @Deprecated
        public java.util.concurrent.ExecutorService executorService()
        Deprecated.
        Description copied from interface: Promise
        This method is deprecated.

        THE DEFAULT IMPLEMENTATION (obtained by one of the Promise factory methods) MIGHT THROW AN UnsupportedOperationException AT RUNTIME, DEPENDING ON WHAT Future.executorService() returns.

        Specified by:
        executorService in interface Promise<T>
        Returns:
        (never)
      • future

        public Future<T> future()
        Description copied from interface: Promise
        Returns the underlying Future of this Promise.
        Specified by:
        future in interface Promise<T>
        Returns:
        The Future.
      • tryComplete

        public boolean tryComplete​(Try<? extends T> value)
        Description copied from interface: Promise
        Attempts to completes this Promise with the given value.
        Specified by:
        tryComplete in interface Promise<T>
        Parameters:
        value - Either a Try.Success containing the result or a Try.Failure containing an exception.
        Returns:
        false if this Promise has already been completed, true otherwise.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object