Module io.helidon.faulttolerance
Package io.helidon.faulttolerance
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 io.helidon.faulttolerance.CircuitBreakerConfig
CircuitBreakerConfig.Builder, CircuitBreakerConfig.BuilderBase<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends CircuitBreakerConfig> -
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 instance of the runtime type from this config object.delay()How long to wait before transitioning from open to half-open state.booleanFlag to enable metrics for this instance.booleanintHow many failures out of 100 will trigger the circuit to open.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.toString()intvolume()Rolling window size used to calculate ratio of failed requests.
-
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
Description copied from interface:Prototype.FactoryCreate a new instance of the runtime type from this config object.- 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.- 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. 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. 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. 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
public int hashCode()
-