Class RetryPolicyExecutor<R>
java.lang.Object
dev.failsafe.spi.PolicyExecutor<R>
dev.failsafe.internal.RetryPolicyExecutor<R>
- Type Parameters:
R- result type
A PolicyExecutor that handles failures according to a
RetryPolicy.- Author:
- Jonathan Halterman
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Performs an execution by calling pre-execute else calling the supplier and doing a post-execute.applyAsync(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.handleAsync(AsyncExecutionInternal<R> execution, Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future, CompletableFuture<ExecutionResult<R>> promise, AtomicReference<ExecutionResult<R>> previousResultRef) onFailure(ExecutionContext<R> context, ExecutionResult<R> result) Performs post-execution handling for aresultthat is considered a failure according toPolicyExecutor.isFailure(ExecutionResult), possibly creating a new result, else returning the originalresult.onFailureAsync(ExecutionContext<R> context, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Defaults async executions to not be complete untilsays they are.Methods inherited from class PolicyExecutor
getPolicyIndex, isFailure, onSuccess, postExecute, postExecuteAsync, preExecute, preExecuteAsync
-
Constructor Details
-
RetryPolicyExecutor
-
-
Method Details
-
apply
public Function<SyncExecutionInternal<R>, ExecutionResult<R>> apply(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Description copied from class:PolicyExecutorPerforms an execution by calling pre-execute else calling the supplier and doing a post-execute.- Overrides:
applyin classPolicyExecutor<R>
-
applyAsync
public Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> applyAsync(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Description copied from class:PolicyExecutorPerforms an async execution by calling pre-execute else calling the supplier and doing a post-execute. Implementors must handle a null result from a supplier, which indicates that an async execution has occurred, that a result will be recorded separately, and that postExecute handling should not be performed.- Overrides:
applyAsyncin classPolicyExecutor<R>
-
handleAsync
public Object handleAsync(AsyncExecutionInternal<R> execution, Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future, CompletableFuture<ExecutionResult<R>> promise, AtomicReference<ExecutionResult<R>> previousResultRef) -
onFailure
Description copied from class:PolicyExecutorPerforms post-execution handling for aresultthat is considered a failure according toPolicyExecutor.isFailure(ExecutionResult), possibly creating a new result, else returning the originalresult.- Overrides:
onFailurein classPolicyExecutor<R>
-
onFailureAsync
public CompletableFuture<ExecutionResult<R>> onFailureAsync(ExecutionContext<R> context, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Defaults async executions to not be complete untilsays they are.- Overrides:
onFailureAsyncin classPolicyExecutor<R>
-