Class CircuitBreakerBuilder
java.lang.Object
com.linecorp.armeria.client.circuitbreaker.CircuitBreakerBuilder
Builds a
CircuitBreaker
instance using builder pattern.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newly-createdCircuitBreaker
based on the properties of this builder.circuitOpenWindow
(Duration circuitOpenWindow) Sets the duration of OPEN state.circuitOpenWindowMillis
(long circuitOpenWindowMillis) Sets the duration of OPEN state in milliseconds.counterSlidingWindow
(Duration counterSlidingWindow) Sets the time length of sliding window to accumulate the count of events.counterSlidingWindowMillis
(long counterSlidingWindowMillis) Sets the time length of sliding window to accumulate the count of events, in milliseconds.counterUpdateInterval
(Duration counterUpdateInterval) Sets the interval that a circuit breaker can see the latest accumulated count of events.counterUpdateIntervalMillis
(long counterUpdateIntervalMillis) Sets the interval that a circuit breaker can see the latest accumulated count of events, in milliseconds.failureRateThreshold
(double failureRateThreshold) Sets the threshold of failure rate to detect a remote service fault.listener
(CircuitBreakerListener listener) Adds aCircuitBreakerListener
.minimumRequestThreshold
(long minimumRequestThreshold) Sets the minimum number of requests within a time window necessary to detect a remote service fault.trialRequestInterval
(Duration trialRequestInterval) Sets the trial request interval in HALF_OPEN state.trialRequestIntervalMillis
(long trialRequestIntervalMillis) Sets the trial request interval in HALF_OPEN state in milliseconds.
-
Method Details
-
failureRateThreshold
Sets the threshold of failure rate to detect a remote service fault. Defaults to 0.5 if unspecified.- Parameters:
failureRateThreshold
- The rate between 0 (exclusive) and 1 (inclusive)
-
minimumRequestThreshold
Sets the minimum number of requests within a time window necessary to detect a remote service fault. Defaults to 10L if unspecified. -
trialRequestInterval
Sets the trial request interval in HALF_OPEN state. Defaults to 3 seconds if unspecified. -
trialRequestIntervalMillis
Sets the trial request interval in HALF_OPEN state in milliseconds. Defaults to 3 seconds if unspecified. -
circuitOpenWindow
Sets the duration of OPEN state. Defaults to 10 seconds if unspecified. -
circuitOpenWindowMillis
Sets the duration of OPEN state in milliseconds. Defaults to 10 seconds if unspecified. -
counterSlidingWindow
Sets the time length of sliding window to accumulate the count of events. Defaults to 20 seconds if unspecified. -
counterSlidingWindowMillis
Sets the time length of sliding window to accumulate the count of events, in milliseconds. Defaults to 20 seconds if unspecified. -
counterUpdateInterval
Sets the interval that a circuit breaker can see the latest accumulated count of events. Defaults to 1 second if unspecified. -
counterUpdateIntervalMillis
Sets the interval that a circuit breaker can see the latest accumulated count of events, in milliseconds. Defaults to 1 second if unspecified. -
listener
Adds aCircuitBreakerListener
. -
build
Returns a newly-createdCircuitBreaker
based on the properties of this builder.
-