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 CircuitBreaker.CompletionCallback
DEFAULT_COMPLETION_CALLBACK
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.CircuitBreaker.CompletionCallback
completionCallback()
static CircuitBreakerConfig.Builder
completionCallback(CircuitBreaker.CompletionCallback completionCallback)
boolean
enabled()
Returns true if this circuit breaker is enabled.static CircuitBreakerConfig.Builder
enabled(boolean enabled)
int
errorThresholdPercentage()
Returns the configured error threshold percentage after which the circuit possibly opens.static CircuitBreakerConfig.Builder
errorThresholdPercentage(int errorThresholdPercentage)
Map<String,Object>
exportAsMap()
Duration
rollingWindow()
Returns the configured rolling window duration which is considered to track the failed ops.static CircuitBreakerConfig.Builder
rollingWindow(Duration rollingWindow)
Duration
sleepWindow()
Returns the configured sleep window after which a canary is allowed to go through.static CircuitBreakerConfig.Builder
sleepWindow(Duration sleepWindow)
int
volumeThreshold()
Returns the volume threshold at which point the circuit will decide if it opens.static CircuitBreakerConfig.Builder
volumeThreshold(int volumeThreshold)
-
-
-
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
-
DEFAULT_COMPLETION_CALLBACK
public static final CircuitBreaker.CompletionCallback DEFAULT_COMPLETION_CALLBACK
-
-
Method Detail
-
builder
public static CircuitBreakerConfig.Builder builder()
Creates a new builder to customize the configuration properties.- Returns:
- a
CircuitBreakerConfig.Builder
to customize.
-
enabled
public static CircuitBreakerConfig.Builder enabled(boolean enabled)
-
volumeThreshold
public static CircuitBreakerConfig.Builder volumeThreshold(int volumeThreshold)
-
errorThresholdPercentage
public static CircuitBreakerConfig.Builder errorThresholdPercentage(int errorThresholdPercentage)
-
sleepWindow
public static CircuitBreakerConfig.Builder sleepWindow(Duration sleepWindow)
-
rollingWindow
public static CircuitBreakerConfig.Builder rollingWindow(Duration rollingWindow)
-
completionCallback
public static CircuitBreakerConfig.Builder completionCallback(CircuitBreaker.CompletionCallback completionCallback)
-
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.
-
completionCallback
public CircuitBreaker.CompletionCallback completionCallback()
-
-