public static class CircuitBreakerConfig.Builder
extends java.lang.Object
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
CircuitBreakerConfig |
build()
Builds a CircuitBreakerConfig
|
CircuitBreakerConfig.Builder |
failureRateThreshold(float failureRateThreshold)
Configures the failure rate threshold in percentage above which the CircuitBreaker should trip open and start short-circuiting calls.
|
CircuitBreakerConfig.Builder |
recordFailure(java.util.function.Predicate<? super java.lang.Throwable> predicate)
Configures a Predicate which evaluates if an exception should be recorded as a failure and thus increase the failure rate.
|
CircuitBreakerConfig.Builder |
ringBufferSizeInClosedState(int ringBufferSizeInClosedState)
Configures the size of the ring buffer when the CircuitBreaker is closed.
|
CircuitBreakerConfig.Builder |
ringBufferSizeInHalfOpenState(int ringBufferSizeInHalfOpenState)
Configures the size of the ring buffer when the CircuitBreaker is half open.
|
CircuitBreakerConfig.Builder |
waitDurationInOpenState(java.time.Duration waitDurationInOpenState)
Configures the wait duration which specifies how long the CircuitBreaker should stay open, before it switches to half open.
|
public CircuitBreakerConfig.Builder failureRateThreshold(float failureRateThreshold)
failureRateThreshold - the failure rate threshold in percentagepublic CircuitBreakerConfig.Builder waitDurationInOpenState(java.time.Duration waitDurationInOpenState)
waitDurationInOpenState - the wait duration which specifies how long the CircuitBreaker should stay openpublic CircuitBreakerConfig.Builder ringBufferSizeInHalfOpenState(int ringBufferSizeInHalfOpenState)
ringBufferSizeInClosedState is 10, then at least 10 calls must be evaluated, before the failure rate can be calculated.
If only 9 calls have been evaluated the CircuitBreaker will not trip back to closed or open even if all 9 calls have failed.
The size must be greater than 0. Default size is 10.ringBufferSizeInHalfOpenState - the size of the ring buffer when the CircuitBreaker is is half openpublic CircuitBreakerConfig.Builder ringBufferSizeInClosedState(int ringBufferSizeInClosedState)
ringBufferSizeInClosedState is 100, then at least 100 calls must be evaluated, before the failure rate can be calculated.
If only 99 calls have been evaluated the CircuitBreaker will not trip open even if all 99 calls have failed.
The size must be greater than 0. Default size is 100.ringBufferSizeInClosedState - the size of the ring buffer when the CircuitBreaker is closed.public CircuitBreakerConfig.Builder recordFailure(java.util.function.Predicate<? super java.lang.Throwable> predicate)
predicate - the Predicate which evaluates if an exception should be recorded as a failure and thus trigger the CircuitBreakerpublic CircuitBreakerConfig build()