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 TypeMethodDescriptionvoid
complete()
Completes the execution and the associatedCompletableFuture
.boolean
Returns whether the execution is complete or if it can be retried.void
Records an executionresult
orexception
which triggers failure handling, if needed, by the configured policies.void
recordException
(Throwable exception) Records anexception
which triggers failure handling, if needed, by the configured policies.void
recordResult
(R result) Records an executionresult
which 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 executionresult
orexception
which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFuture
is completed.- Throws:
IllegalStateException
- if the most recent execution was already recorded or the execution is complete
-
recordResult
Records an executionresult
which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFuture
is completed.- Throws:
IllegalStateException
- if the most recent execution was already recorded or the execution is complete
-
recordException
Records anexception
which triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFuture
is completed.- Throws:
IllegalStateException
- if the most recent execution was already recorded or the execution is complete
-