Package dev.failsafe
Class FallbackConfig<R>
- java.lang.Object
-
- dev.failsafe.PolicyConfig<R>
-
- dev.failsafe.FailurePolicyConfig<R>
-
- dev.failsafe.FallbackConfig<R>
-
- Type Parameters:
R
- result type
public class FallbackConfig<R> extends FailurePolicyConfig<R>
Configuration for aFallback
.This class is threadsafe.
- See Also:
FallbackBuilder
-
-
Field Summary
Fields Modifier and Type Field Description (package private) boolean
async
(package private) EventListener<ExecutionAttemptedEvent<R>>
failedAttemptListener
(package private) CheckedFunction<ExecutionAttemptedEvent<R>,R>
fallback
(package private) CheckedFunction<ExecutionAttemptedEvent<R>,java.util.concurrent.CompletableFuture<R>>
fallbackStage
-
Fields inherited from class dev.failsafe.FailurePolicyConfig
exceptionsChecked, failureConditions
-
Fields inherited from class dev.failsafe.PolicyConfig
failureListener, successListener
-
-
Constructor Summary
Constructors Constructor Description FallbackConfig()
FallbackConfig(FallbackConfig<R> config)
FallbackConfig(CheckedFunction<ExecutionAttemptedEvent<R>,R> fallback, CheckedFunction<ExecutionAttemptedEvent<R>,java.util.concurrent.CompletableFuture<R>> fallbackStage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventListener<ExecutionAttemptedEvent<R>>
getFailedAttemptListener()
Returns the failed attempt event listener.CheckedFunction<ExecutionAttemptedEvent<R>,R>
getFallback()
Returns the fallback function, elsenull
if a fallback stage function was configured instead.CheckedFunction<ExecutionAttemptedEvent<R>,java.util.concurrent.CompletableFuture<R>>
getFallbackStage()
Returns the fallback stage function, elsenull
if a fallback function was configured instead.boolean
isAsync()
Returns whether the Fallback is configured to handle execution results asynchronously, separate from execution.-
Methods inherited from class dev.failsafe.FailurePolicyConfig
getFailureConditions, isExceptionsChecked
-
Methods inherited from class dev.failsafe.PolicyConfig
getFailureListener, getSuccessListener
-
-
-
-
Field Detail
-
fallback
CheckedFunction<ExecutionAttemptedEvent<R>,R> fallback
-
fallbackStage
CheckedFunction<ExecutionAttemptedEvent<R>,java.util.concurrent.CompletableFuture<R>> fallbackStage
-
async
boolean async
-
failedAttemptListener
EventListener<ExecutionAttemptedEvent<R>> failedAttemptListener
-
-
Constructor Detail
-
FallbackConfig
FallbackConfig()
-
FallbackConfig
FallbackConfig(FallbackConfig<R> config)
-
FallbackConfig
FallbackConfig(CheckedFunction<ExecutionAttemptedEvent<R>,R> fallback, CheckedFunction<ExecutionAttemptedEvent<R>,java.util.concurrent.CompletableFuture<R>> fallbackStage)
-
-
Method Detail
-
getFallback
public CheckedFunction<ExecutionAttemptedEvent<R>,R> getFallback()
Returns the fallback function, elsenull
if a fallback stage function was configured instead.- See Also:
Fallback.of(CheckedRunnable)
,Fallback.of(CheckedSupplier)
,Fallback.of(CheckedConsumer)
,Fallback.of(CheckedFunction)
,Fallback.of(Object)
,Fallback.ofException(CheckedFunction)
,Fallback.builder(CheckedRunnable)
,Fallback.builder(CheckedSupplier)
,Fallback.builder(CheckedConsumer)
,Fallback.builder(CheckedFunction)
,Fallback.builder(Object)
,Fallback.builderOfException(CheckedFunction)
-
getFallbackStage
public CheckedFunction<ExecutionAttemptedEvent<R>,java.util.concurrent.CompletableFuture<R>> getFallbackStage()
Returns the fallback stage function, elsenull
if a fallback function was configured instead.
-
isAsync
public boolean isAsync()
Returns whether the Fallback is configured to handle execution results asynchronously, separate from execution.- See Also:
FallbackBuilder.withAsync()
-
getFailedAttemptListener
public EventListener<ExecutionAttemptedEvent<R>> getFailedAttemptListener()
Returns the failed attempt event listener.
-
-