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