public static class CircuitBreakerConfig.Builder extends Object
Constructor and Description |
---|
Builder() |
Modifier and Type | Method and Description |
---|---|
CircuitBreakerConfig |
build()
Creates a new
CircuitBreakerConfig out of the configured properties. |
CircuitBreakerConfig.Builder |
completionCallback(CircuitBreaker.CompletionCallback completionCallback)
Allows customizing of the completion callback which defines what is considered a failure and what success.
|
CircuitBreakerConfig.Builder |
enabled(boolean enabled)
Enables or disables this circuit breaker.
|
CircuitBreakerConfig.Builder |
errorThresholdPercentage(int errorThresholdPercentage)
The percentage of operations that need to fail in a window until the circuit is opened.
|
CircuitBreakerConfig.Builder |
rollingWindow(Duration rollingWindow)
How long the window is in which the number of failed ops are tracked in a rolling fashion.
|
CircuitBreakerConfig.Builder |
sleepWindow(Duration sleepWindow)
The sleep window that is waited from when the circuit opens to when the canary is tried.
|
CircuitBreakerConfig.Builder |
volumeThreshold(int volumeThreshold)
The volume threshold defines how many operations need to be in the window at least so that
the threshold percentage can be meaningfully calculated.
|
public CircuitBreakerConfig.Builder enabled(boolean enabled)
If this property is set to false, then all other properties are not looked at.
enabled
- if true enables it, if false disables it.CircuitBreakerConfig.Builder
for chaining purposes.public CircuitBreakerConfig.Builder volumeThreshold(int volumeThreshold)
The default is 20.
volumeThreshold
- the volume threshold in the interval.CircuitBreakerConfig.Builder
for chaining purposes.public CircuitBreakerConfig.Builder errorThresholdPercentage(int errorThresholdPercentage)
The default is 50.
errorThresholdPercentage
- the percent of ops that need to fail.CircuitBreakerConfig.Builder
for chaining purposes.public CircuitBreakerConfig.Builder sleepWindow(Duration sleepWindow)
The default is 5 seconds.
sleepWindow
- the sleep window as a duration.CircuitBreakerConfig.Builder
for chaining purposes.public CircuitBreakerConfig.Builder rollingWindow(Duration rollingWindow)
The default is 1 minute.
rollingWindow
- the rolling window duration.CircuitBreakerConfig.Builder
for chaining purposes.public CircuitBreakerConfig.Builder completionCallback(CircuitBreaker.CompletionCallback completionCallback)
completionCallback
- the custom completion callback.CircuitBreakerConfig.Builder
for chaining purposes.public CircuitBreakerConfig build()
CircuitBreakerConfig
out of the configured properties.CircuitBreakerConfig
.Copyright © 2020 Couchbase, Inc.. All rights reserved.