Interface RequestExecutionLifetime


public interface RequestExecutionLifetime
Controls the lifetime of a RequestExecutionEngine run and reports when it finishes. Obtained from RequestExecution.lifetime().

A run can be paused and resumed, or cancelled outright. Completion is observed either by blocking on awaitCompletion() or by registering an onComplete callback - the API deliberately does not expose a CompletableFuture.

  • Method Summary

    Modifier and Type
    Method
    Description
    Block the calling thread until the run finishes (drains or is cancelled) and return its final result.
    void
    Cancel the run.
    boolean
     
    void
    Register a callback to be invoked once when the run finishes (drains or is cancelled), without blocking.
    void
    Pause the run: stop sending new requests.
    void
    Resume a paused run.
  • Method Details

    • pause

      void pause()
      Pause the run: stop sending new requests. Requests already in flight are allowed to finish. Has no effect if the run has already finished. Resume with resume().
    • resume

      void resume()
      Resume a paused run. Has no effect if the run is not paused or has already finished.
    • cancel

      void cancel()
      Cancel the run. No further requests are scheduled; requests already in flight are allowed to finish, after which the run completes with the partial results. Requests abandoned before they were sent are recorded with RequestStatus.DROPPED.
    • finished

      boolean finished()
      Returns:
      true once every queued request has finished or the run has been cancelled.
    • awaitCompletion

      RequestExecutionResult awaitCompletion()
      Block the calling thread until the run finishes (drains or is cancelled) and return its final result. Returns immediately if the run has already finished.
      Returns:
      The run's RequestExecutionResult.
    • onComplete

      void onComplete(CompletionHandler handler)
      Register a callback to be invoked once when the run finishes (drains or is cancelled), without blocking. If the run has already finished, the handler is invoked immediately.
      Parameters:
      handler - The handler to invoke with the final RequestExecutionResult.