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
Allows asynchronous executions to record their results or complete an execution.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcomplete()Completes the execution and the associatedCompletableFuture.booleanReturns whether the execution is complete or if it can be retried.voidRecords an executionresultorexceptionwhich triggers failure handling, if needed, by the configured policies.voidrecordException(Throwable exception) Records anexceptionwhich triggers failure handling, if needed, by the configured policies.voidrecordResult(R result) Records an executionresultwhich triggers failure handling, if needed, by the configured policies.Methods inherited from interface dev.failsafe.ExecutionContext
getAttemptCount, getElapsedAttemptTime, getElapsedTime, getExecutionCount, getLastException, getLastResult, getLastResult, getStartTime, isCancelled, isFirstAttempt, isRetry, onCancel
-
Method Details
-
complete
void complete()Completes the execution and the associatedCompletableFuture.- 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
Records an executionresultorexceptionwhich triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFutureis completed.- Throws:
IllegalStateException- if the most recent execution was already recorded or the execution is complete
-
recordResult
Records an executionresultwhich triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFutureis completed.- Throws:
IllegalStateException- if the most recent execution was already recorded or the execution is complete
-
recordException
Records anexceptionwhich triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFutureis completed.- Throws:
IllegalStateException- if the most recent execution was already recorded or the execution is complete
-