Package dev.failsafe

Interface AsyncExecution<R>

Type Parameters:
R - result type
All Superinterfaces:
ExecutionContext<R>
All Known Subinterfaces:
AsyncExecutionInternal<R>
All Known Implementing Classes:
AsyncExecutionImpl

public interface AsyncExecution<R> extends ExecutionContext<R>
Allows asynchronous executions to record their results or complete an execution.
  • Method Details

    • complete

      void complete()
      Completes the execution and the associated CompletableFuture.
      Throws:
      IllegalStateException - if the execution is already recorded or complete
    • isComplete

      boolean isComplete()
      Returns whether the execution is complete or if it can be retried. An execution is considered complete only when all configured policies consider the execution complete.
    • record

      void record(R result, Throwable exception)
      Records an execution result or exception which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resulting CompletableFuture is completed.
      Throws:
      IllegalStateException - if the most recent execution was already recorded or the execution is complete
    • recordResult

      void recordResult(R result)
      Records an execution result which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resulting CompletableFuture is completed.
      Throws:
      IllegalStateException - if the most recent execution was already recorded or the execution is complete
    • recordException

      void recordException(Throwable exception)
      Records an exception which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resulting CompletableFuture is completed.
      Throws:
      IllegalStateException - if the most recent execution was already recorded or the execution is complete