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 Object
implements PolicyListeners<S,R>
Builds policies.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiononFailure
(EventListener<ExecutionCompletedEvent<R>> listener) Registers thelistener
to be called when the policy fails to handle an execution.onSuccess
(EventListener<ExecutionCompletedEvent<R>> listener) Registers thelistener
to be called when the policy succeeds in handling an execution.
-
Field Details
-
config
-
-
Constructor Details
-
PolicyBuilder
-
-
Method Details
-
onFailure
Description copied from interface:PolicyListeners
Registers thelistener
to 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
listener
are ignored. To provide an alternative result for a failed execution, use aFallback
.- Specified by:
onFailure
in interfacePolicyListeners<S,
C extends PolicyConfig<R>>
-
onSuccess
Description copied from interface:PolicyListeners
Registers thelistener
to 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
listener
are ignored.- Specified by:
onSuccess
in interfacePolicyListeners<S,
C extends PolicyConfig<R>>
-