public static final class MultiDbConfig.CircuitBreakerConfig
extends java.lang.Object
This class encapsulates all circuit breaker-related settings including failure rate threshold, sliding window size, minimum failures, and exception handling.
| Modifier and Type | Class and Description |
|---|---|
static class |
MultiDbConfig.CircuitBreakerConfig.Builder
Builder for
MultiDbConfig.CircuitBreakerConfig. |
| Modifier and Type | Method and Description |
|---|---|
static MultiDbConfig.CircuitBreakerConfig.Builder |
builder()
Creates a new Builder instance for configuring CircuitBreakerConfig.
|
float |
getFailureRateThreshold()
Returns the failure rate threshold percentage for circuit breaker activation.
|
java.util.List<java.lang.Class> |
getIgnoreExceptionList()
Returns the list of exception classes that are ignored by the circuit breaker and neither
count as failures nor successes.
|
java.util.List<java.lang.Class> |
getIncludedExceptionList()
Returns the list of exception classes that are recorded as circuit breaker failures and
increase the failure rate.
|
int |
getMinNumOfFailures()
Returns the minimum number of failures before circuit breaker is tripped.
|
int |
getSlidingWindowSize()
Returns the size of the sliding window used to record call outcomes when the circuit breaker
is CLOSED.
|
public float getFailureRateThreshold()
0.0f means failure rate is ignored, and only minimum number of failures is considered.
When the failure rate exceeds both this threshold and the minimum number of failures, the circuit breaker transitions to the OPEN state and starts short-circuiting calls, immediately failing them without attempting to reach the Redis database. This prevents cascading failures and allows the system to fail over to the next available database.
Range: 0.0 to 100.0 (percentage)
getMinNumOfFailures()public int getSlidingWindowSize()
Default:
public int getMinNumOfFailures()
0 means minimum number of failures is ignored, and only failure rate is considered.
When the number of failures exceeds both this threshold and the failure rate threshold, the circuit breaker will trip and prevent further requests from being sent to the database until it has recovered.
getFailureRateThreshold()public java.util.List<java.lang.Class> getIncludedExceptionList()
Any exception that matches or inherits from the classes in this list counts as a failure for
circuit breaker calculations, unless explicitly ignored via
getIgnoreExceptionList(). If you specify this list, all other exceptions count as
successes unless they are explicitly ignored.
Default: JedisConnectionException
getIgnoreExceptionList()public java.util.List<java.lang.Class> getIgnoreExceptionList()
Any exception that matches or inherits from the classes in this list will not affect circuit
breaker failure rate calculations, even if the exception is included in
getIncludedExceptionList().
Default: null (no exceptions ignored)
getIncludedExceptionList()public static MultiDbConfig.CircuitBreakerConfig.Builder builder()
Copyright © 2025. All rights reserved.