Class CircuitBreakerConfig
- java.lang.Object
-
- com.couchbase.client.core.endpoint.CircuitBreakerConfig
-
public class CircuitBreakerConfig extends Object
Allows configuring aCircuitBreaker
.- Since:
- 2.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CircuitBreakerConfig.Builder
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_ENABLED
static int
DEFAULT_ERROR_THRESHOLD_PERCENTAGE
static Duration
DEFAULT_ROLLING_WINDOW
static Duration
DEFAULT_SLEEP_WINDOW
static int
DEFAULT_VOLUME_THRESHOLD
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CircuitBreakerConfig.Builder
builder()
Creates a new builder to customize the configuration properties.static CircuitBreakerConfig
create()
Creates a newCircuitBreakerConfig
with the default settings applied.static CircuitBreakerConfig
disabled()
Creates a newCircuitBreakerConfig
which disables the circuit breaker.boolean
enabled()
Returns true if this circuit breaker is enabled.int
errorThresholdPercentage()
Returns the configured error threshold percentage after which the circuit possibly opens.Duration
rollingWindow()
Returns the configured rolling window duration which is considered to track the failed ops.Duration
sleepWindow()
Returns the configured sleep window after which a canary is allowed to go through.int
volumeThreshold()
Returns the volume threshold at which point the circuit will decide if it opens.
-
-
-
Field Detail
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
- See Also:
- Constant Field Values
-
DEFAULT_VOLUME_THRESHOLD
public static final int DEFAULT_VOLUME_THRESHOLD
- See Also:
- Constant Field Values
-
DEFAULT_ERROR_THRESHOLD_PERCENTAGE
public static final int DEFAULT_ERROR_THRESHOLD_PERCENTAGE
- See Also:
- Constant Field Values
-
DEFAULT_SLEEP_WINDOW
public static final Duration DEFAULT_SLEEP_WINDOW
-
DEFAULT_ROLLING_WINDOW
public static final Duration DEFAULT_ROLLING_WINDOW
-
-
Method Detail
-
builder
public static CircuitBreakerConfig.Builder builder()
Creates a new builder to customize the configuration properties.- Returns:
- a
CircuitBreakerConfig.Builder
to customize.
-
create
public static CircuitBreakerConfig create()
Creates a newCircuitBreakerConfig
with the default settings applied.- Returns:
- a new
CircuitBreakerConfig
with defaults.
-
disabled
public static CircuitBreakerConfig disabled()
Creates a newCircuitBreakerConfig
which disables the circuit breaker.- Returns:
- a new disabled
CircuitBreakerConfig
.
-
enabled
public boolean enabled()
Returns true if this circuit breaker is enabled.
-
volumeThreshold
public int volumeThreshold()
Returns the volume threshold at which point the circuit will decide if it opens.
-
errorThresholdPercentage
public int errorThresholdPercentage()
Returns the configured error threshold percentage after which the circuit possibly opens.
-
sleepWindow
public Duration sleepWindow()
Returns the configured sleep window after which a canary is allowed to go through.
-
rollingWindow
public Duration rollingWindow()
Returns the configured rolling window duration which is considered to track the failed ops.
-
-