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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcomplete()Completes the execution and the associatedCompletableFuture.booleanisComplete()Returns whether the execution is complete or if it can be retried.voidrecord(R result, java.lang.Throwable exception)Records an executionresultorexceptionwhich triggers failure handling, if needed, by the configured policies.voidrecordException(java.lang.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 Detail
-
complete
void complete()
Completes the execution and the associatedCompletableFuture.- Throws:
java.lang.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, java.lang.Throwable exception)
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:
java.lang.IllegalStateException- if the most recent execution was already recorded or the execution is complete
-
recordResult
void recordResult(R result)
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:
java.lang.IllegalStateException- if the most recent execution was already recorded or the execution is complete
-
recordException
void recordException(java.lang.Throwable exception)
Records anexceptionwhich triggers failure handling, if needed, by the configured policies. If policy handling is not possible or already complete, the resultingCompletableFutureis completed.- Throws:
java.lang.IllegalStateException- if the most recent execution was already recorded or the execution is complete
-
-