Package dev.failsafe
Interface PolicyListeners<S,R>
-
- Type Parameters:
S- self typeR- result type
- All Known Implementing Classes:
BulkheadBuilder,CircuitBreakerBuilder,DelayablePolicyBuilder,FailurePolicyBuilder,FallbackBuilder,PolicyBuilder,RateLimiterBuilder,RetryPolicyBuilder,TimeoutBuilder
public interface PolicyListeners<S,R>Configures listeners for a policy execution result.
-
-
Method Summary
All Methods Instance Methods Abstract 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.
-
-
-
Method Detail
-
onFailure
S onFailure(EventListener<ExecutionCompletedEvent<R>> listener)
Registers 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.
-
onSuccess
S onSuccess(EventListener<ExecutionCompletedEvent<R>> listener)
Registers 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.
-
-