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 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:
RetryConfig.Builder
- Enclosing interface:
RetryConfig
public abstract static class RetryConfig.BuilderBase<BUILDER extends RetryConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends RetryConfig>
extends Object
implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER, PROTOTYPE>
Fluent API builder base for
RetryConfig.-
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 retriable.addApplyOn(Set<Class<? extends Throwable>> applyOn) These throwables will be considered retriable.These throwables will not be considered retriable, all other will.These throwables will not be considered retriable, all other will.applyOn()These throwables will be considered retriable.These throwables will be considered retriable.intcalls()Number of calls, including the initial call and retries, which must be at least1.calls(int calls) Number of calls, including the initial call and retries, which must be at least1.Clear all applyOn.Clear existing value of maxDelay.Clear existing value of name.Clear existing value of retryPolicy.Clear all skipOn.config()Configuration used to configure this instance.Update builder from configuration (node of this type).delay()Non-negative base delay between the initial call and retries, which defaults to200 ms.Non-negative base delay between the initial call and retries, which defaults to200 ms.doubleDelay multiplier that must be-1or finite and non-negative;-1selects2unless either jitter option is configured, and an explicit multiplier is applied before jitter.delayFactor(double delayFactor) Delay multiplier that must be-1or finite and non-negative;-1selects2unless either jitter option is configured, and an explicit multiplier is applied before jitter.booleanFlag to enable metrics for this instance.enableMetrics(boolean enableMetrics) Flag to enable metrics for this instance.from(RetryConfig prototype) Update this builder from an existing prototype instance.from(RetryConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.jitter()Absolute random jitter that must bePT-1S(disabled) or non-negative; it cannot be combined withjitter-factor, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present.Absolute random jitter that must bePT-1S(disabled) or non-negative; it cannot be combined withjitter-factor, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present.doubleRelative random jitter that must be-1(disabled) or from0(inclusive) to1(exclusive); it cannot be combined withjitter, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present.jitterFactor(double jitterFactor) Relative random jitter that must be-1(disabled) or from0(inclusive) to1(exclusive); it cannot be combined withjitter, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present.maxDelay()Optional non-negative maximum delay applied after jitter; when absent, the delay is not capped.Optional non-negative maximum delay applied after jitter; when absent, the delay is not capped.name()Name for debugging, error reporting, monitoring.Name for debugging, error reporting, monitoring.Positive overall timeout used to bound the complete retry sequence.overallTimeout(Duration overallTimeout) Positive overall timeout used to bound the complete retry sequence.protected voidHandles providers and decorators.Explicitly configured retry policy.retryPolicy(Retry.RetryPolicy retryPolicy) Explicitly configured retry policy.skipOn()These throwables will not be considered retriable, all other will.These throwables will not be considered retriable, all other will.toString()protected voidValidates required properties.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 RetryConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends RetryConfig>- 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
-
calls
Number of calls, including the initial call and retries, which must be at least1.- Parameters:
calls- number of desired calls, must be 1 (means no retries) or higher.- Returns:
- updated builder instance
- See Also:
-
delay
-
delayFactor
Delay multiplier that must be-1or finite and non-negative;-1selects2unless either jitter option is configured, and an explicit multiplier is applied before jitter.- Parameters:
delayFactor- delay factor for delaying retry policy- Returns:
- updated builder instance
- See Also:
-
jitter
Absolute random jitter that must bePT-1S(disabled) or non-negative; it cannot be combined withjitter-factor, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present.- Parameters:
jitter- jitter- Returns:
- updated builder instance
- See Also:
-
jitterFactor
Relative random jitter that must be-1(disabled) or from0(inclusive) to1(exclusive); it cannot be combined withjitter, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present. A value of0.2applies a random jitter of up to twenty percent in either direction.- Parameters:
jitterFactor- relative jitter factor- Returns:
- updated builder instance
- See Also:
-
clearMaxDelay
Clear existing value of maxDelay.- Returns:
- updated builder instance
- See Also:
-
maxDelay
-
overallTimeout
-
clearSkipOn
-
skipOn
-
addSkipOn
-
addSkipOn
-
clearApplyOn
-
applyOn
-
addApplyOn
-
addApplyOn
-
clearRetryPolicy
Clear existing value of retryPolicy.- Returns:
- updated builder instance
- See Also:
-
retryPolicy
Explicitly configured retry policy. The most recently configured policy-related option takes precedence. Configuring calls, delay, delay factor, jitter, jitter factor, or maximum delay after this option clears it so a new policy is derived from those settings.- Parameters:
retryPolicy- retry policy- Returns:
- updated builder instance
- See Also:
-
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
-
calls
public int calls()Number of calls, including the initial call and retries, which must be at least1.- Returns:
- number of desired calls, must be 1 (means no retries) or higher.
-
delay
Non-negative base delay between the initial call and retries, which defaults to200 ms.- Returns:
- delay between retries (combines with retry policy)
-
delayFactor
public double delayFactor()Delay multiplier that must be-1or finite and non-negative;-1selects2unless either jitter option is configured, and an explicit multiplier is applied before jitter.- Returns:
- delay factor for delaying retry policy
-
jitter
Absolute random jitter that must bePT-1S(disabled) or non-negative; it cannot be combined withjitter-factor, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present.- Returns:
- jitter
-
jitterFactor
public double jitterFactor()Relative random jitter that must be-1(disabled) or from0(inclusive) to1(exclusive); it cannot be combined withjitter, is applied independently afterdelay-factor, does not affect later base-delay calculations, and is capped bymax-delaywhen present. A value of0.2applies a random jitter of up to twenty percent in either direction.- Returns:
- relative jitter factor
-
maxDelay
-
overallTimeout
Positive overall timeout used to bound the complete retry sequence.- Returns:
- overall timeout
-
skipOn
-
applyOn
-
retryPolicy
Explicitly configured retry policy. The most recently configured policy-related option takes precedence. Configuring calls, delay, delay factor, jitter, jitter factor, or maximum delay after this option clears it so a new policy is derived from those settings.- Returns:
- retry policy
-
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
-