Module io.helidon.faulttolerance
Package io.helidon.faulttolerance
Class CircuitBreakerConfig.BuilderBase<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends CircuitBreakerConfig>
java.lang.Object
io.helidon.faulttolerance.CircuitBreakerConfig.BuilderBase<BUILDER,PROTOTYPE>
- Type Parameters:
BUILDER
- type of the builder extending this abstract builderPROTOTYPE
- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,
,PROTOTYPE> Prototype.ConfiguredBuilder<BUILDER,
PROTOTYPE>
- Direct Known Subclasses:
CircuitBreakerConfig.Builder
- Enclosing interface:
CircuitBreakerConfig
public abstract static class CircuitBreakerConfig.BuilderBase<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends CircuitBreakerConfig>
extends Object
implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for
CircuitBreaker
.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Generated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddApplyOn
(Class<? extends Throwable> applyOn) These throwables will be considered failures.addApplyOn
(Set<Class<? extends Throwable>> applyOn) These throwables will be considered failures.These throwables will not be considered failures, all other will.These throwables will not be considered failures, all other will.applyOn()
These throwables will be considered failures.These throwables will be considered failures.Clear existing value of this property.Clear existing value of this property.config()
If this instance was configured, this would be the config instance used.Update builder from configuration (node of this type).delay()
How long to wait before transitioning from open to half-open state.How long to wait before transitioning from open to half-open state.int
How many failures out of 100 will trigger the circuit to open.errorRatio
(int errorRatio) How many failures out of 100 will trigger the circuit to open.executor()
Executor service to schedule future tasks.executor
(ExecutorService executor) Executor service to schedule future tasks.from
(CircuitBreakerConfig prototype) Update this builder from an existing prototype instance.from
(CircuitBreakerConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.name()
protected void
Handles providers and decorators.skipOn()
These throwables will not be considered failures, all other will.These throwables will not be considered failures, all other will.int
How many successful calls will close a half-open circuit.successThreshold
(int successThreshold) How many successful calls will close a half-open circuit.toString()
protected void
Validates required properties.int
volume()
Rolling window size used to calculate ratio of failed requests.volume
(int volume) Rolling window size used to calculate ratio of failed requests.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
Methods inherited from interface io.helidon.builder.api.Prototype.ConfiguredBuilder
discoverService, discoverServices
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype
- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder
- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
config
in interfacePrototype.ConfiguredBuilder<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends CircuitBreakerConfig> - Parameters:
config
- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
clearName
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
name
- Parameters:
name
-- Returns:
- updated builder instance
- See Also:
-
delay
How long to wait before transitioning from open to half-open state.- Parameters:
delay
- delay- Returns:
- updated builder instance
- See Also:
-
errorRatio
How many failures out of 100 will trigger the circuit to open. This is adapted to thevolume()
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.
- Parameters:
errorRatio
- percent of failure that trigger the circuit to open- Returns:
- updated builder instance
- See Also:
-
volume
Rolling window size used to calculate ratio of failed requests. Default is 10.- Parameters:
volume
- how big a window is used to calculate error errorRatio- Returns:
- updated builder instance
- See Also:
-
successThreshold
How many successful calls will close a half-open circuit. Nevertheless, the first failed call will open the circuit again. Default is 1.- Parameters:
successThreshold
- number of calls- Returns:
- updated builder instance
- See Also:
-
clearExecutor
Clear existing value of this property.- Returns:
- updated builder instance
- See Also:
-
executor
Executor service to schedule future tasks.- Parameters:
executor
- executor to use- Returns:
- updated builder instance
- See Also:
-
skipOn
These throwables will not be considered failures, all other will.- Parameters:
skipOn
- throwable classes to not be considered a failure- Returns:
- updated builder instance
- See Also:
-
addSkipOn
These throwables will not be considered failures, all other will.- Parameters:
skipOn
- throwable classes to not be considered a failure- Returns:
- updated builder instance
- See Also:
-
addSkipOn
These throwables will not be considered failures, all other will.- Parameters:
skipOn
- throwable classes to not be considered a failure- Returns:
- updated builder instance
- See Also:
-
applyOn
These throwables will be considered failures.- Parameters:
applyOn
- throwable classes to be considered a failure- Returns:
- updated builder instance
- See Also:
-
addApplyOn
These throwables will be considered failures.- Parameters:
applyOn
- throwable classes to be considered a failure- Returns:
- updated builder instance
- See Also:
-
addApplyOn
These throwables will be considered failures.- Parameters:
applyOn
- throwable classes to be considered a failure- Returns:
- updated builder instance
- See Also:
-
name
- Returns:
- the name
-
delay
How long to wait before transitioning from open to half-open state.- Returns:
- the delay
-
errorRatio
public int errorRatio()How many failures out of 100 will trigger the circuit to open. This is adapted to thevolume()
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.
- Returns:
- the error ratio
- See Also:
-
volume
public int volume()Rolling window size used to calculate ratio of failed requests. Default is 10.- Returns:
- the volume
- See Also:
-
successThreshold
public int successThreshold()How many successful calls will close a half-open circuit. Nevertheless, the first failed call will open the circuit again. Default is 1.- Returns:
- the success threshold
-
executor
Executor service to schedule future tasks.- Returns:
- the executor
-
skipOn
These throwables will not be considered failures, all other will.- Returns:
- the skip on
- See Also:
-
applyOn
These throwables will be considered failures.- Returns:
- the apply on
- See Also:
-
config
If this instance was configured, this would be the config instance used.- Returns:
- config node used to configure this builder, or empty if not configured
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties.
-