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 int
Default error ratio.static final int
Default success threshold.static final int
Default volume. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CircuitBreakerConfigImpl
(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.boolean
Flag to enable metrics for this instance.boolean
int
How many failures out of 100 will trigger the circuit to open.executor()
Executor service to schedule future tasks.get()
int
hashCode()
name()
Name of this circuit breaker.skipOn()
These throwables will not be considered failures, all other will.int
How many successful calls will close a half-open circuit.toString()
int
volume()
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.Factory
Create a new instance of the runtime type from this config object.- Specified by:
build
in interfacePrototype.Factory<CircuitBreaker>
- Returns:
- new configured runtime instance
-
get
- Specified by:
get
in interfaceSupplier<CircuitBreaker>
-
name
Description copied from interface:CircuitBreakerConfig
Name of this circuit breaker.- Specified by:
name
in interfaceCircuitBreakerConfig
- Returns:
- name
-
delay
Description copied from interface:CircuitBreakerConfig
How long to wait before transitioning from open to half-open state.- Specified by:
delay
in interfaceCircuitBreakerConfig
- Returns:
- delay
-
errorRatio
public int errorRatio()Description copied from interface:CircuitBreakerConfig
How 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:
errorRatio
in interfaceCircuitBreakerConfig
- Returns:
- percent of failure that trigger the circuit to open
- See Also:
-
volume
public int volume()Description copied from interface:CircuitBreakerConfig
Rolling window size used to calculate ratio of failed requests. Default is 10.- Specified by:
volume
in interfaceCircuitBreakerConfig
- Returns:
- how big a window is used to calculate error errorRatio
- See Also:
-
successThreshold
public int successThreshold()Description copied from interface:CircuitBreakerConfig
How many successful calls will close a half-open circuit. Nevertheless, the first failed call will open the circuit again. Default is 1.- Specified by:
successThreshold
in interfaceCircuitBreakerConfig
- Returns:
- number of calls
-
executor
Description copied from interface:CircuitBreakerConfig
Executor service to schedule future tasks.- Specified by:
executor
in interfaceCircuitBreakerConfig
- Returns:
- executor to use
-
skipOn
Description copied from interface:CircuitBreakerConfig
These throwables will not be considered failures, all other will.- Specified by:
skipOn
in interfaceCircuitBreakerConfig
- Returns:
- throwable classes to not be considered a failure
- See Also:
-
applyOn
Description copied from interface:CircuitBreakerConfig
These throwables will be considered failures.- Specified by:
applyOn
in interfaceCircuitBreakerConfig
- Returns:
- throwable classes to be considered a failure
- See Also:
-
enableMetrics
public boolean enableMetrics()Description copied from interface:CircuitBreakerConfig
Flag 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:
enableMetrics
in interfaceCircuitBreakerConfig
- Returns:
- metrics enabled flag
-
toString
-
equals
-
hashCode
public int hashCode()
-