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) intFields inherited from class DelayablePolicyConfig
delay, delayException, delayFn, delayResultFields inherited from class FailurePolicyConfig
exceptionsChecked, failureConditionsFields inherited from class 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.intUsed with time based thresholding.intUsed with time based thresholding.intGets the number of failures that must occur within thefailure thresholding capacitywhen in a CLOSED or HALF_OPEN state in order to open the circuit.intReturns 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.intGets the number of successes that must occur within thesuccess thresholding capacitywhen in a HALF_OPEN state in order to open the circuit.intReturns the rolling capacity for storing execution results when performing success thresholding in the HALF_OPEN state.Methods inherited from class DelayablePolicyConfig
getDelayException, getDelayFn, getDelayResultMethods inherited from class FailurePolicyConfig
getFailureConditions, isExceptionsCheckedMethods inherited from class 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:
getDelayin classDelayablePolicyConfig<R>- See Also:
-
getFailureThreshold
public int getFailureThreshold()Gets the number of failures that must occur within thefailure thresholding capacitywhen in a CLOSED or HALF_OPEN state in order to open the circuit. Returns1by 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.1by 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, else0if 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, elsenullif 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 thresholdingthis also determines the minimum number of executions that must be recorded in the HALF_OPEN state. Returns0by default.- See Also:
-
getSuccessThreshold
public int getSuccessThreshold()Gets the number of successes that must occur within thesuccess thresholding capacitywhen in a HALF_OPEN state in order to open the circuit. Returns0by default, in which case thefailure thresholdis 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:
-