Package dev.failsafe
Class PolicyBuilder<S,C extends PolicyConfig<R>,R>
- java.lang.Object
-
- dev.failsafe.PolicyBuilder<S,C,R>
-
- Type Parameters:
S- self typeC- config typeR- result type
- All Implemented Interfaces:
PolicyListeners<S,R>
- Direct Known Subclasses:
BulkheadBuilder,FailurePolicyBuilder,RateLimiterBuilder,TimeoutBuilder
public abstract class PolicyBuilder<S,C extends PolicyConfig<R>,R> extends java.lang.Object implements PolicyListeners<S,R>
Builds policies.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPolicyBuilder(C config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SonFailure(EventListener<ExecutionCompletedEvent<R>> listener)Registers thelistenerto be called when the policy fails to handle an execution.SonSuccess(EventListener<ExecutionCompletedEvent<R>> listener)Registers thelistenerto be called when the policy succeeds in handling an execution.
-
-
-
Field Detail
-
config
protected C extends PolicyConfig<R> config
-
-
Constructor Detail
-
PolicyBuilder
protected PolicyBuilder(C config)
-
-
Method Detail
-
onFailure
public S onFailure(EventListener<ExecutionCompletedEvent<R>> listener)
Description copied from interface:PolicyListenersRegisters thelistenerto be called when the policy fails to handle an execution. This means that not only was the supplied execution considered a failure by the policy, but that the policy was unable to produce a successful result.Note: Any exceptions that are thrown from within the
listenerare ignored. To provide an alternative result for a failed execution, use aFallback.- Specified by:
onFailurein interfacePolicyListeners<S,C extends PolicyConfig<R>>
-
onSuccess
public S onSuccess(EventListener<ExecutionCompletedEvent<R>> listener)
Description copied from interface:PolicyListenersRegisters thelistenerto be called when the policy succeeds in handling an execution. This means that the supplied execution either succeeded, or if it failed, the policy was able to produce a successful result.Note: Any exceptions that are thrown from within the
listenerare ignored.- Specified by:
onSuccessin interfacePolicyListeners<S,C extends PolicyConfig<R>>
-
-