Package dev.failsafe
Class CircuitBreakerConfig<R>
java.lang.Object
dev.failsafe.PolicyConfig<R>
dev.failsafe.FailurePolicyConfig<R>
dev.failsafe.DelayablePolicyConfig<R>
dev.failsafe.CircuitBreakerConfig<R>
- Type Parameters:
R
- result type
Configuration for a
CircuitBreaker
.
This class is threadsafe.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) EventListener
<CircuitBreakerStateChangedEvent> (package private) int
(package private) int
(package private) int
(package private) int
(package private) Duration
(package private) EventListener
<CircuitBreakerStateChangedEvent> (package private) EventListener
<CircuitBreakerStateChangedEvent> (package private) int
(package private) int
Fields inherited from class dev.failsafe.DelayablePolicyConfig
delay, delayException, delayFn, delayResult
Fields inherited from class dev.failsafe.FailurePolicyConfig
exceptionsChecked, failureConditions
Fields inherited from class dev.failsafe.PolicyConfig
failureListener, successListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the close event listener.getDelay()
Returns the delay before allowing another execution on the circuit.int
Used with time based thresholding.int
Used with time based thresholding.int
Gets the number of failures that must occur within thefailure thresholding capacity
when in a CLOSED or HALF_OPEN state in order to open the circuit.int
Returns the rolling capacity for storing execution results when performing failure thresholding in the CLOSED or HALF_OPEN states.Used with time based thresholding.Returns the half-open event listener.Returns the open event listener.int
Gets the number of successes that must occur within thesuccess thresholding capacity
when in a HALF_OPEN state in order to open the circuit.int
Returns the rolling capacity for storing execution results when performing success thresholding in the HALF_OPEN state.Methods inherited from class dev.failsafe.DelayablePolicyConfig
getDelayException, getDelayFn, getDelayResult
Methods inherited from class dev.failsafe.FailurePolicyConfig
getFailureConditions, isExceptionsChecked
Methods inherited from class dev.failsafe.PolicyConfig
getFailureListener, getSuccessListener
-
Field Details
-
failureThreshold
int failureThreshold -
failureRateThreshold
int failureRateThreshold -
failureThresholdingCapacity
int failureThresholdingCapacity -
failureExecutionThreshold
int failureExecutionThreshold -
failureThresholdingPeriod
Duration failureThresholdingPeriod -
successThreshold
int successThreshold -
successThresholdingCapacity
int successThresholdingCapacity -
openListener
EventListener<CircuitBreakerStateChangedEvent> openListener -
halfOpenListener
EventListener<CircuitBreakerStateChangedEvent> halfOpenListener -
closeListener
EventListener<CircuitBreakerStateChangedEvent> closeListener
-
-
Constructor Details
-
CircuitBreakerConfig
CircuitBreakerConfig() -
CircuitBreakerConfig
CircuitBreakerConfig(CircuitBreakerConfig<R> config)
-
-
Method Details
-
getDelay
Returns the delay before allowing another execution on the circuit. Defaults to 1 minute.- Overrides:
getDelay
in classDelayablePolicyConfig<R>
- See Also:
-
getFailureThreshold
public int getFailureThreshold()Gets the number of failures that must occur within thefailure thresholding capacity
when in a CLOSED or HALF_OPEN state in order to open the circuit. Returns1
by default.- See Also:
-
getFailureThresholdingCapacity
public int getFailureThresholdingCapacity()Returns the rolling capacity for storing execution results when performing failure thresholding in the CLOSED or HALF_OPEN states.1
by default. Only the most recent executions that fit within this capacity contribute to thresholding decisions.- See Also:
-
getFailureRateThreshold
public int getFailureRateThreshold()Used with time based thresholding. Returns percentage rate of failures, from 1 to 100, that must occur when in a CLOSED or HALF_OPEN state in order to open the circuit, else0
if failure rate thresholding is not configured.- See Also:
-
getFailureThresholdingPeriod
Used with time based thresholding. Returns the rolling time period during which failure thresholding is performed when in the CLOSED state, elsenull
if time based failure thresholding is not configured. Only the most recent executions that occurred within this rolling time period contribute to thresholding decisions.- See Also:
-
getFailureExecutionThreshold
public int getFailureExecutionThreshold()Used with time based thresholding. Returns the minimum number of executions that must be recorded in the CLOSED state before the breaker can be opened. Forfailure rate thresholding
this also determines the minimum number of executions that must be recorded in the HALF_OPEN state. Returns0
by default.- See Also:
-
getSuccessThreshold
public int getSuccessThreshold()Gets the number of successes that must occur within thesuccess thresholding capacity
when in a HALF_OPEN state in order to open the circuit. Returns0
by default, in which case thefailure threshold
is used instead.- See Also:
-
getSuccessThresholdingCapacity
public int getSuccessThresholdingCapacity()Returns the rolling capacity for storing execution results when performing success thresholding in the HALF_OPEN state. Only the most recent executions that fit within this capacity contribute to thresholding decisions.- See Also:
-
getOpenListener
Returns the open event listener.- See Also:
-
getHalfOpenListener
Returns the half-open event listener.- See Also:
-
getCloseListener
Returns the close event listener.- See Also:
-