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 classCircuitBreakerConfig.Builder
-
Field Summary
Fields Modifier and Type Field Description static CircuitBreaker.CompletionCallbackDEFAULT_COMPLETION_CALLBACKstatic booleanDEFAULT_ENABLEDstatic intDEFAULT_ERROR_THRESHOLD_PERCENTAGEstatic DurationDEFAULT_ROLLING_WINDOWstatic DurationDEFAULT_SLEEP_WINDOWstatic intDEFAULT_VOLUME_THRESHOLD
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CircuitBreakerConfig.Builderbuilder()Creates a new builder to customize the configuration properties.CircuitBreaker.CompletionCallbackcompletionCallback()static CircuitBreakerConfig.BuildercompletionCallback(CircuitBreaker.CompletionCallback completionCallback)booleanenabled()Returns true if this circuit breaker is enabled.static CircuitBreakerConfig.Builderenabled(boolean enabled)interrorThresholdPercentage()Returns the configured error threshold percentage after which the circuit possibly opens.static CircuitBreakerConfig.BuildererrorThresholdPercentage(int errorThresholdPercentage)Map<String,Object>exportAsMap()DurationrollingWindow()Returns the configured rolling window duration which is considered to track the failed ops.static CircuitBreakerConfig.BuilderrollingWindow(Duration rollingWindow)DurationsleepWindow()Returns the configured sleep window after which a canary is allowed to go through.static CircuitBreakerConfig.BuildersleepWindow(Duration sleepWindow)intvolumeThreshold()Returns the volume threshold at which point the circuit will decide if it opens.static CircuitBreakerConfig.BuildervolumeThreshold(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.Builderto 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()
-
-