public final class CircuitBreakerPolicy extends Policy
CircuitBreaker
annotation an a specific method.Modifier and Type | Field and Description |
---|---|
long |
delay |
ChronoUnit |
delayUnit |
double |
failureRatio |
int |
requestVolumeThreshold |
int |
successThreshold |
Constructor and Description |
---|
CircuitBreakerPolicy(Method annotatedMethod,
Class<? extends Throwable>[] failOn,
Class<? extends Throwable>[] skipOn,
long delay,
ChronoUnit delayUnit,
int requestVolumeThreshold,
double failureRatio,
int successThreshold) |
Modifier and Type | Method and Description |
---|---|
static CircuitBreakerPolicy |
create(javax.interceptor.InvocationContext context,
FaultToleranceConfig config) |
boolean |
isFailure(Throwable ex)
Helper method that checks whether or not the given exception is considered a success or failure.
|
checkAtLeast, checkAtLeast, checkAtLeast, checkAtMost, checkReturnsSameAs, checkReturnsSameAs, describe, isCaught
public final long delay
public final ChronoUnit delayUnit
public final int requestVolumeThreshold
public final double failureRatio
public final int successThreshold
public static CircuitBreakerPolicy create(javax.interceptor.InvocationContext context, FaultToleranceConfig config)
public boolean isFailure(Throwable ex)
CircuitBreaker
documentation:
When a method returns a result, the following rules are applied to determine whether the result is a success or a failure:
- If the method does not throw a
Throwable
, it is considered a success- Otherwise, if the thrown object is assignable to any value in the
#skipOn()
parameter, is is considered a success- Otherwise, if the thrown object is assignable to any value in the
#failOn()
parameter, it is considered a failure- Otherwise it is considered a success
ex
- The exception to checkCopyright © 2021. All rights reserved.