Interface ProgressToken<T>


public interface ProgressToken<T>
  • Method Details

    • getCompletionStage

      CompletionStage<T> getCompletionStage()
      Gets the already started CompletionStage which completes with the result. This instance can be used to execute calls after the progress has finished and listens to exceptions thrown during the progress.
      Returns:
      NotNull instance of CompletionStage.
    • onProgress

      ProgressToken<T> onProgress(Consumer<Double> progress)
      Adds a new consumer to the progressToken which gets called each time the progress percentage from 0.0(0%) to 1.0 (100%) changes. Is at least called once for 0.0 and once for 1.0.
      Parameters:
      progress - Consumer.
      Returns:
      This instance.
    • onException

      ProgressToken<T> onException(Consumer<Throwable> exception)
      Adds a new consumer to the progressToken which gets called if the the progress fails with an exception.
      Parameters:
      exception - Consumer.
      Returns:
      This instance.
    • onResult

      ProgressToken<T> onResult(Consumer<T> result)
      Adds a new consumer to the progressToken which gets called once the the progress completes.
      Parameters:
      result - Consumer.
      Returns:
      This instance.
    • isCancelled

      boolean isCancelled()
      Is the progress cancelled or not.
      Returns:
      True if cancelled. False if not.
    • cancel

      void cancel()
      Cancels the progress if it has not finished yet.