@Inherited
 @Retention(value=RUNTIME)
 @Documented
 @Target(value={METHOD,TYPE})
public @interface CircuitBreaker
A circuit breaker aims to prevent further damage by not executing functionality that is doomed to fail. After a failure situation has been detected, circuit breakers prevent methods from being executed and instead throw exceptions immediately. After a certain delay or wait time, the functionality is attempted to be executed again.
A circuit breaker can be in one of the following states:
requestVolumeThreshold and failureRatio parameters may be configured in
 order to specify the conditions under which the breaker will transition the circuit to open. If the failure
 conditions are met, the circuit will be opened.successThreshold
 parameter allows the configuration of the number of trial executions that must succeed before the circuit can be
 closed. After the specified number of successful executions, the circuit will be closed. If a failure occurs before
 the successThreshold is reached the circuit will transition to open.When a method returns a result, the following rules are applied to determine whether the result is a success or a failure:
Throwable, it is considered a success
 skipOn() parameter, it is considered a
 success
 failOn() parameter, it is considered a
 failure
 Throwable which is not an Error or Exception, non-portable behavior
 results.failOn(), 
skipOn(), 
delay(), 
delayUnit(), 
requestVolumeThreshold(), 
failureRatio(), 
successThreshold()| Modifier and Type | Optional Element and Description | 
|---|---|
| long | delayThe delay after which an open circuit will transitions to half-open state. | 
| java.time.temporal.ChronoUnit | delayUnitThe unit of the delay after which an open circuit will transitions to half-open state. | 
| java.lang.Class<? extends java.lang.Throwable>[] | failOnThe list of exception types which should be considered failures. | 
| double | failureRatioThe ratio of failures within the rolling window that will trip the circuit to open. | 
| int | requestVolumeThresholdThe number of consecutive requests in a rolling window. | 
| java.lang.Class<? extends java.lang.Throwable>[] | skipOnThe list of exception types which should not be considered failures. | 
| int | successThresholdThe number of successful executions, before a half-open circuit is closed again. | 
public abstract java.lang.Class<? extends java.lang.Throwable>[] failOn
 Note that if a method throws a Throwable which is not an Error or Exception, non-portable
 behavior results.
public abstract java.lang.Class<? extends java.lang.Throwable>[] skipOn
 This list takes priority over the types listed in failOn().
 
 Note that if a method throws a Throwable which is not an Error or Exception, non-portable
 behavior results.
public abstract long delay
 The amount of delay is taken from this delay value and the delayUnit, and defaults to five seconds. The
 value must be greater than or equal to 0. 0 means no delay.
public abstract java.time.temporal.ChronoUnit delayUnit
delay()public abstract int requestVolumeThreshold
 The circuit breaker will trip if the number of failures exceed the failureRatio within the rolling window
 of consecutive requests. The value must be greater than or equal to 1.
public abstract double failureRatio
 The circuit breaker will trip if the number of failures exceed the failureRatio within the rolling window
 of consecutive requests. For example, if the requestVolumeThreshold is 20 and
 failureRatio is .50, ten or more failures in 20 consecutive requests will trigger the circuit to
 open. The value must be between 0 and 1 inclusive.
public abstract int successThreshold
 A half-open circuit will be closed once successThreshold executions were made without failures. If a
 failure occurs while in half-open state the circuit is immediately opened again. The value must be greater than
 or equal to 1.