S - self typeR - result typepublic class PolicyListeners<S,R> extends Object
| Constructor and Description |
|---|
PolicyListeners() |
| Modifier and Type | Method and Description |
|---|---|
S |
onFailure(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener)
Registers the
listener to be called when a Policy fails to handle an execution. |
S |
onSuccess(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener)
Registers the
listener to be called when a Policy succeeds in handling an execution. |
public S onFailure(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener)
listener to be called when a 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.
public S onSuccess(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener)
listener to be called when a 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.
Copyright © 2021. All rights reserved.