Class CircuitBreakerBuilder
java.lang.Object
com.linecorp.armeria.client.circuitbreaker.CircuitBreakerBuilder
public final class CircuitBreakerBuilder extends Object
Builds a
CircuitBreaker
instance using builder pattern.-
Method Summary
Modifier and Type Method Description CircuitBreaker
build()
Returns a newly-createdCircuitBreaker
based on the properties of this builder.CircuitBreakerBuilder
circuitOpenWindow(Duration circuitOpenWindow)
Sets the duration of OPEN state.CircuitBreakerBuilder
circuitOpenWindowMillis(long circuitOpenWindowMillis)
Sets the duration of OPEN state in milliseconds.CircuitBreakerBuilder
counterSlidingWindow(Duration counterSlidingWindow)
Sets the time length of sliding window to accumulate the count of events.CircuitBreakerBuilder
counterSlidingWindowMillis(long counterSlidingWindowMillis)
Sets the time length of sliding window to accumulate the count of events, in milliseconds.CircuitBreakerBuilder
counterUpdateInterval(Duration counterUpdateInterval)
Sets the interval that a circuit breaker can see the latest accumulated count of events.CircuitBreakerBuilder
counterUpdateIntervalMillis(long counterUpdateIntervalMillis)
Sets the interval that a circuit breaker can see the latest accumulated count of events, in milliseconds.CircuitBreakerBuilder
failureRateThreshold(double failureRateThreshold)
Sets the threshold of failure rate to detect a remote service fault.CircuitBreakerBuilder
listener(CircuitBreakerListener listener)
Adds aCircuitBreakerListener
.CircuitBreakerBuilder
minimumRequestThreshold(long minimumRequestThreshold)
Sets the minimum number of requests within a time window necessary to detect a remote service fault.CircuitBreakerBuilder
trialRequestInterval(Duration trialRequestInterval)
Sets the trial request interval in HALF_OPEN state.CircuitBreakerBuilder
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.
-