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>, ConfigBuilderSupport.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 ConfigBuilderSupport.ConfiguredBuilder<BUILDER, PROTOTYPE>
Fluent API builder base for
CircuitBreakerConfig.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classGenerated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
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 all applyOn.Clear existing value of executor.Clear existing value of name.Clear all skipOn.config()Configuration used to configure this instance.Update builder from configuration (node of this type).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.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.enableMetrics(boolean enableMetrics) Flag to enable metrics for this instance.intHow 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.errorRatio(int errorRatio) How 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.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()Name of this circuit breaker.Name of this circuit breaker.protected voidHandles providers and decorators.skipOn()These throwables will not be considered failures, all other will.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.successThreshold(int successThreshold) How many successful calls will close a half-open circuit; must be at least 1.toString()protected voidValidates required properties.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.volume(int volume) 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.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Prototype.Builder
buildPrototype, self
-
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:
configin interfaceConfigBuilderSupport.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 name.- Returns:
- updated builder instance
- See Also:
-
name
-
delay
-
errorRatio
How 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 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; must be at least 1 and its product with the configured error ratio must not exceed 2,147,483,647. 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; must be at least 1. 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 executor.- Returns:
- updated builder instance
- See Also:
-
executor
Executor service to schedule future tasks.- Parameters:
executor- executor to use- Returns:
- updated builder instance
- See Also:
-
clearSkipOn
-
skipOn
-
addSkipOn
-
addSkipOn
-
clearApplyOn
-
applyOn
-
addApplyOn
-
addApplyOn
-
enableMetrics
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.- Parameters:
enableMetrics- metrics enabled flag- Returns:
- updated builder instance
- See Also:
-
name
-
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.- Returns:
- delay
-
errorRatio
public int errorRatio()How 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 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:
- percent of failure that trigger the circuit to open
- See Also:
-
volume
public int volume()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. Default is 10.- Returns:
- how big a window is used to calculate error errorRatio
- See Also:
-
successThreshold
public int successThreshold()How 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.- Returns:
- number of calls
-
executor
Executor service to schedule future tasks.- Returns:
- executor to use
-
skipOn
-
applyOn
-
enableMetrics
public boolean enableMetrics()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.- Returns:
- metrics enabled flag
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties. -
config
-