Class PromiseImpl<T>

java.lang.Object
io.vavr.concurrent.PromiseImpl<T>
Type Parameters:
T - result type
All Implemented Interfaces:
Promise<T>

final class PromiseImpl<T> extends Object implements Promise<T>
Internal Promise implementation.
  • Field Details

  • Constructor Details

  • Method Details

    • executor

      public 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 Executor associated with this Promise
    • executorService

      @Deprecated public 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 associated with this Promise.
      Specified by:
      future in interface Promise<T>
      Returns:
      the underlying Future
    • tryComplete

      public boolean tryComplete(@NonNull Try<? extends T> value)
      Description copied from interface: Promise
      Attempts to complete this Promise with the given value.
      Specified by:
      tryComplete in interface Promise<T>
      Parameters:
      value - a Try.Success containing the result or a Try.Failure containing an exception
      Returns:
      true if the Promise was completed successfully, false if it was already completed
    • toString

      public String toString()
      Overrides:
      toString in class Object