Class RetryConfig.BuilderBase<BUILDER extends RetryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends RetryConfig>

java.lang.Object
io.helidon.faulttolerance.RetryConfig.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:
RetryConfig.Builder
Enclosing interface:
RetryConfig

public abstract static class RetryConfig.BuilderBase<BUILDER extends RetryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends RetryConfig> extends Object implements Prototype.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for Retry.
  • Constructor Details

    • BuilderBase

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

    • from

      public BUILDER from(RetryConfig 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(RetryConfig.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 RetryConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends RetryConfig>
      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)
      Name for debugging, error reporting, monitoring.
      Parameters:
      name - name of this retry
      Returns:
      updated builder instance
      See Also:
    • calls

      public BUILDER calls(int calls)
      Number of calls (first try + retries).
      Parameters:
      calls - number of desired calls, must be 1 (means no retries) or higher.
      Returns:
      updated builder instance
      See Also:
    • delay

      public BUILDER delay(Duration delay)
      Base delay between try and retry. Defaults to 200 ms.
      Parameters:
      delay - delay between retries (combines with retry policy)
      Returns:
      updated builder instance
      See Also:
    • delayFactor

      public BUILDER delayFactor(double delayFactor)
      Delay retry policy factor. If unspecified (value of -1), Jitter retry policy would be used, unless jitter is also unspecified.

      Default when Retry.DelayingRetryPolicy is used is 2.

      Parameters:
      delayFactor - delay factor for delaying retry policy
      Returns:
      updated builder instance
      See Also:
    • jitter

      public BUILDER jitter(Duration jitter)
      Jitter for Retry.JitterRetryPolicy. If unspecified (value of -1), delaying retry policy is used. If both this value, and delayFactor() are specified, delaying retry policy would be used.
      Parameters:
      jitter - jitter
      Returns:
      updated builder instance
      See Also:
    • overallTimeout

      public BUILDER overallTimeout(Duration overallTimeout)
      Overall timeout of all retries combined.
      Parameters:
      overallTimeout - overall timeout
      Returns:
      updated builder instance
      See Also:
    • skipOn

      public BUILDER skipOn(Set<Class<? extends Throwable>> skipOn)
      These throwables will not be considered retriable, all other will.
      Parameters:
      skipOn - throwable classes to skip retries
      Returns:
      updated builder instance
      See Also:
    • addSkipOn

      public BUILDER addSkipOn(Set<Class<? extends Throwable>> skipOn)
      These throwables will not be considered retriable, all other will.
      Parameters:
      skipOn - throwable classes to skip retries
      Returns:
      updated builder instance
      See Also:
    • addSkipOn

      public BUILDER addSkipOn(Class<? extends Throwable> skipOn)
      These throwables will not be considered retriable, all other will.
      Parameters:
      skipOn - throwable classes to skip retries
      Returns:
      updated builder instance
      See Also:
    • applyOn

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

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

      public BUILDER addApplyOn(Class<? extends Throwable> applyOn)
      These throwables will be considered retriable.
      Parameters:
      applyOn - throwable classes to trigger retries
      Returns:
      updated builder instance
      See Also:
    • clearRetryPolicy

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

      public BUILDER retryPolicy(Retry.RetryPolicy retryPolicy)
      Explicitly configured retry policy.
      Parameters:
      retryPolicy - retry policy
      Returns:
      updated builder instance
      See Also:
    • name

      public Optional<String> name()
      Name for debugging, error reporting, monitoring.
      Returns:
      the name
    • calls

      public int calls()
      Number of calls (first try + retries).
      Returns:
      the calls
    • delay

      public Duration delay()
      Base delay between try and retry. Defaults to 200 ms.
      Returns:
      the delay
    • delayFactor

      public double delayFactor()
      Delay retry policy factor. If unspecified (value of -1), Jitter retry policy would be used, unless jitter is also unspecified.

      Default when Retry.DelayingRetryPolicy is used is 2.

      Returns:
      the delay factor
    • jitter

      public Duration jitter()
      Jitter for Retry.JitterRetryPolicy. If unspecified (value of -1), delaying retry policy is used. If both this value, and delayFactor() are specified, delaying retry policy would be used.
      Returns:
      the jitter
    • overallTimeout

      public Duration overallTimeout()
      Overall timeout of all retries combined.
      Returns:
      the overall timeout
    • skipOn

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

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

      public Optional<Retry.RetryPolicy> retryPolicy()
      Explicitly configured retry policy.
      Returns:
      the retry policy
    • 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.