Annotation Interface CircuitBreaker
@Inherited
@Retention(RUNTIME)
@Documented
@InterceptorBinding
@Target({METHOD,TYPE})
public @interface CircuitBreaker
Define the Circuit Breaker policy
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionlong
The delay.Define the failure criteriadouble
The failure threshold to trigger the circuit to open.int
The number of consecutive requests in a rolling window that will trip the circuit.int
For an open circuit, after the delay period is reached, once the successThreshold is reached, the circuit is back to close again.
-
Element Details
-
failOn
Define the failure criteriaA method call will be considered a failure if it throws an exception and the type of that exception is assignable to any of the types listed in
failOn
.- Returns:
- the exception types which should be considered failures
- Default:
- {java.lang.Throwable.class}
-
delay
long delayThe delay. The value must be greater than or equal to 0. 0 means no delay.- Returns:
- The delay time after the circuit is open
- Default:
- 5000L
-
delayUnit
ChronoUnit delayUnit- Returns:
- The delay unit after the circuit is open
- Default:
- MILLIS
-
requestVolumeThreshold
int requestVolumeThresholdThe number of consecutive requests in a rolling window that will trip the circuit. The value must be greater than or equal to 1.- Returns:
- the number of the consecutive requests in a rolling window
- Default:
- 20
-
failureRatio
double failureRatioThe failure threshold to trigger the circuit to open. e.g. if the requestVolumeThreshold is 20 and failureRation is .50, 10 or more failures in 20 consecutive requests will trigger the circuit to open. The value must be between 0 and 1 inclusive.- Returns:
- The failure threshold to open the circuit
- Default:
- 0.5
-
successThreshold
int successThresholdFor an open circuit, after the delay period is reached, once the successThreshold is reached, the circuit is back to close again. The value must be greater than or equal to 1.- Returns:
- The success threshold to fully close the circuit
- Default:
- 1
-