Class FallbackExecutor<R>
java.lang.Object
dev.failsafe.spi.PolicyExecutor<R>
dev.failsafe.internal.FallbackExecutor<R>
- Type Parameters:
R- result type
A PolicyExecutor that handles failures according to a
Fallback.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FallbackConfig<R> private final EventHandler<R> private final FallbackImpl<R> -
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, applying a fallback if it fails, and calling 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.Methods inherited from class PolicyExecutor
getPolicyIndex, isFailure, onFailure, onFailureAsync, onSuccess, postExecute, postExecuteAsync, preExecute, preExecuteAsync
-
Field Details
-
fallback
-
config
-
failedAttemptHandler
-
-
Constructor Details
-
FallbackExecutor
-
-
Method Details
-
apply
public Function<SyncExecutionInternal<R>, ExecutionResult<R>> apply(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Performs an execution by calling pre-execute else calling the supplier, applying a fallback if it fails, and calling 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) Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.- Overrides:
applyAsyncin classPolicyExecutor<R>
-