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 builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.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.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(CircuitBreakerConfig prototype)
      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

      public BUILDER from(CircuitBreakerConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config 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 interface Prototype.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

      public BUILDER clearName()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • name

      public BUILDER name(String name)
      Parameters:
      name -
      Returns:
      updated builder instance
      See Also:
    • delay

      public BUILDER delay(Duration delay)
      How long to wait before transitioning from open to half-open state.
      Parameters:
      delay - delay
      Returns:
      updated builder instance
      See Also:
    • errorRatio

      public BUILDER errorRatio(int errorRatio)
      How many failures out of 100 will trigger the circuit to open. This is adapted to the 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.

      Parameters:
      errorRatio - percent of failure that trigger the circuit to open
      Returns:
      updated builder instance
      See Also:
    • volume

      public BUILDER volume(int 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

      public BUILDER 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.
      Parameters:
      successThreshold - number of calls
      Returns:
      updated builder instance
      See Also:
    • clearExecutor

      public BUILDER clearExecutor()
      Clear existing value of this property.
      Returns:
      updated builder instance
      See Also:
    • executor

      public BUILDER executor(ExecutorService executor)
      Executor service to schedule future tasks.
      Parameters:
      executor - executor to use
      Returns:
      updated builder instance
      See Also:
    • skipOn

      public BUILDER skipOn(Set<Class<? extends Throwable>> 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

      public BUILDER addSkipOn(Set<Class<? extends Throwable>> 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

      public BUILDER addSkipOn(Class<? extends Throwable> 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:
    • applyOn

      public BUILDER applyOn(Set<Class<? extends Throwable>> applyOn)
      These throwables will be considered failures.
      Parameters:
      applyOn - throwable classes to be considered a failure
      Returns:
      updated builder instance
      See Also:
    • addApplyOn

      public BUILDER addApplyOn(Set<Class<? extends Throwable>> applyOn)
      These throwables will be considered failures.
      Parameters:
      applyOn - throwable classes to be considered a failure
      Returns:
      updated builder instance
      See Also:
    • addApplyOn

      public BUILDER addApplyOn(Class<? extends Throwable> applyOn)
      These throwables will be considered failures.
      Parameters:
      applyOn - throwable classes to be considered a failure
      Returns:
      updated builder instance
      See Also:
    • name

      public Optional<String> name()
      Returns:
      the name
    • delay

      public Duration 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 the 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.

      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

      public Optional<ExecutorService> executor()
      Executor service to schedule future tasks.
      Returns:
      the executor
    • skipOn

      public Set<Class<? extends Throwable>> skipOn()
      These throwables will not be considered failures, all other will.
      Returns:
      the skip on
      See Also:
    • applyOn

      public Set<Class<? extends Throwable>> applyOn()
      These throwables will be considered failures.
      Returns:
      the apply on
      See Also:
    • config

      public Optional<Config> 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

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.