Class CircuitBreakerConfig.BuilderBase.CircuitBreakerConfigImpl
java.lang.Object
io.helidon.faulttolerance.CircuitBreakerConfig.BuilderBase.CircuitBreakerConfigImpl
- All Implemented Interfaces:
Prototype.Api, Prototype.Factory<CircuitBreaker>, CircuitBreakerConfig, Supplier<CircuitBreaker>
- Enclosing class:
CircuitBreakerConfig.BuilderBase<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends CircuitBreakerConfig>
protected static class CircuitBreakerConfig.BuilderBase.CircuitBreakerConfigImpl
extends Object
implements CircuitBreakerConfig, Supplier<CircuitBreaker>
Generated implementation of the prototype, can be extended by descendant prototype implementations.
-
Nested Class Summary
Nested classes/interfaces inherited from interface CircuitBreakerConfig
CircuitBreakerConfig.Builder, CircuitBreakerConfig.BuilderBase<BUILDER, PROTOTYPE>Modifier and TypeInterfaceDescriptionstatic classFluent API builder forCircuitBreaker.static classCircuitBreakerConfig.BuilderBase<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends CircuitBreakerConfig>Fluent API builder base forCircuitBreakerConfig. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault error ratio.static final intDefault success threshold.static final intDefault volume. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCircuitBreakerConfigImpl(CircuitBreakerConfig.BuilderBase<?, ?> builder) Create an instance providing a builder. -
Method Summary
Modifier and TypeMethodDescriptionapplyOn()These throwables will be considered failures.build()Create a new runtime instance from this prototype.delay()How long to wait before transitioning from open to half-open state; must not be negative and must be small enough to represent in milliseconds.booleanFlag to enable metrics for this instance.booleanintHow many failures out of 100 will trigger the circuit to open; must be between 1 and 100, inclusive, and its product with the configured volume must not exceed 2,147,483,647.executor()Executor service to schedule future tasks.get()inthashCode()name()Name of this circuit breaker.skipOn()These throwables will not be considered failures, all other will.intHow many successful calls will close a half-open circuit; must be at least 1.toString()intvolume()Rolling window size used to calculate ratio of failed requests; must be at least 1 and its product with the configured error ratio must not exceed 2,147,483,647.
-
Field Details
-
DEFAULT_ERROR_RATIO
static final int DEFAULT_ERROR_RATIODefault error ratio.- See Also:
-
DEFAULT_SUCCESS_THRESHOLD
static final int DEFAULT_SUCCESS_THRESHOLDDefault success threshold.- See Also:
-
DEFAULT_VOLUME
static final int DEFAULT_VOLUMEDefault volume.- See Also:
-
-
Constructor Details
-
CircuitBreakerConfigImpl
Create an instance providing a builder.- Parameters:
builder- extending builder base of this prototype
-
-
Method Details
-
build
Create a new runtime instance from this prototype.- Specified by:
buildin interfacePrototype.Factory<CircuitBreaker>- Returns:
- new configured runtime instance
-
get
- Specified by:
getin interfaceSupplier<CircuitBreaker>
-
name
Description copied from interface:CircuitBreakerConfigName of this circuit breaker.- Specified by:
namein interfaceCircuitBreakerConfig- Returns:
- name
-
delay
Description copied from interface:CircuitBreakerConfigHow long to wait before transitioning from open to half-open state; must not be negative and must be small enough to represent in milliseconds.- Specified by:
delayin interfaceCircuitBreakerConfig- Returns:
- delay
-
errorRatio
public int errorRatio()Description copied from interface:CircuitBreakerConfigHow many failures out of 100 will trigger the circuit to open; must be between 1 and 100, inclusive, and its product with the configured volume must not exceed 2,147,483,647. This is adapted to theCircuitBreakerConfig.volume()used to handle the window of requests.If errorRatio is 40, and volume is 10, 4 failed requests will open the circuit. Default is 60.
- Specified by:
errorRatioin interfaceCircuitBreakerConfig- Returns:
- percent of failure that trigger the circuit to open
- See Also:
-
volume
public int volume()Description copied from interface:CircuitBreakerConfigRolling window size used to calculate ratio of failed requests; must be at least 1 and its product with the configured error ratio must not exceed 2,147,483,647. Default is 10.- Specified by:
volumein interfaceCircuitBreakerConfig- Returns:
- how big a window is used to calculate error errorRatio
- See Also:
-
successThreshold
public int successThreshold()Description copied from interface:CircuitBreakerConfigHow many successful calls will close a half-open circuit; must be at least 1. Nevertheless, the first failed call will open the circuit again. Default is 1.- Specified by:
successThresholdin interfaceCircuitBreakerConfig- Returns:
- number of calls
-
executor
Description copied from interface:CircuitBreakerConfigExecutor service to schedule future tasks.- Specified by:
executorin interfaceCircuitBreakerConfig- Returns:
- executor to use
-
skipOn
Description copied from interface:CircuitBreakerConfigThese throwables will not be considered failures, all other will.- Specified by:
skipOnin interfaceCircuitBreakerConfig- Returns:
- throwable classes to not be considered a failure
- See Also:
-
applyOn
Description copied from interface:CircuitBreakerConfigThese throwables will be considered failures.- Specified by:
applyOnin interfaceCircuitBreakerConfig- Returns:
- throwable classes to be considered a failure
- See Also:
-
enableMetrics
public boolean enableMetrics()Description copied from interface:CircuitBreakerConfigFlag to enable metrics for this instance. The value of this flag is combined with the global config entryFaultTolerance.FT_METRICS_DEFAULT_ENABLED. If either of these flags istrue, then metrics will be enabled for the instance.- Specified by:
enableMetricsin interfaceCircuitBreakerConfig- Returns:
- metrics enabled flag
-
toString
-
equals
-
hashCode
-