- All Superinterfaces:
Prototype.Api,Prototype.Factory<CircuitBreaker>
- All Known Implementing Classes:
CircuitBreakerConfig.BuilderBase.CircuitBreakerConfigImpl
Configuration of a circuit breaker.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forCircuitBreaker.static classCircuitBreakerConfig.BuilderBase<BUILDER extends CircuitBreakerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends CircuitBreakerConfig> Fluent API builder base forCircuitBreaker. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault error ratio.static final intDefault success threshold.static final intDefault volume. -
Method Summary
Modifier and TypeMethodDescriptionapplyOn()These throwables will be considered failures.static CircuitBreakerConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static CircuitBreakerConfig.Builderbuilder(CircuitBreakerConfig instance) Create a new fluent API builder from an existing instance.static CircuitBreakerConfigcreate()Create a new instance with default values.static CircuitBreakerConfigDeprecated.static CircuitBreakerConfigCreate a new instance from configuration.delay()How long to wait before transitioning from open to half-open state.booleanFlag to enable metrics for this instance.intHow many failures out of 100 will trigger the circuit to open.executor()Executor service to schedule future tasks.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.intvolume()Rolling window size used to calculate ratio of failed requests.Methods inherited from interface io.helidon.builder.api.Prototype.Factory
build
-
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:
-
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Deprecated.Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
name
Name of this circuit breaker.- Returns:
- name
-
delay
Duration delay()How long to wait before transitioning from open to half-open state.- Returns:
- delay
-
errorRatio
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:
- percent of failure that trigger the circuit to open
- See Also:
-
volume
int volume()Rolling window size used to calculate ratio of failed requests. Default is 10.- Returns:
- how big a window is used to calculate error errorRatio
- See Also:
-
successThreshold
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:
- number of calls
-
executor
Optional<ExecutorService> executor()Executor service to schedule future tasks.- Returns:
- executor to use
-
skipOn
These throwables will not be considered failures, all other will.- Returns:
- throwable classes to not be considered a failure
- See Also:
-
applyOn
These throwables will be considered failures.- Returns:
- throwable classes to be considered a failure
- See Also:
-
enableMetrics
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
-
create(io.helidon.config.Config)