S
- self typeC
- config typeR
- result typepublic abstract class PolicyBuilder<S,C extends PolicyConfig<R>,R> extends Object implements PolicyListeners<S,R>
Modifier | Constructor and Description |
---|---|
protected |
PolicyBuilder(C config) |
Modifier and Type | Method and Description |
---|---|
S |
onFailure(EventListener<ExecutionCompletedEvent<R>> listener)
Registers the
listener to be called when the policy fails to handle an execution. |
S |
onSuccess(EventListener<ExecutionCompletedEvent<R>> listener)
Registers the
listener to be called when the policy succeeds in handling an execution. |
protected C extends PolicyConfig<R> config
protected PolicyBuilder(C config)
public S onFailure(EventListener<ExecutionCompletedEvent<R>> listener)
PolicyListeners
listener
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 a Fallback
.
onFailure
in interface PolicyListeners<S,R>
public S onSuccess(EventListener<ExecutionCompletedEvent<R>> listener)
PolicyListeners
listener
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.
onSuccess
in interface PolicyListeners<S,R>
Copyright © 2022. All rights reserved.