Interface RetryConfig
- All Superinterfaces:
Prototype.Api, Prototype.Factory<Retry>
- All Known Implementing Classes:
RetryConfig.BuilderBase.RetryConfigImpl
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forRetry.static classRetryConfig.BuilderBase<BUILDER extends RetryConfig.BuilderBase<BUILDER, PROTOTYPE>, PROTOTYPE extends RetryConfig>Fluent API builder base forRetryConfig. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionapplyOn()These throwables will be considered retriable.static RetryConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static RetryConfig.Builderbuilder(RetryConfig instance) Create a new fluent API builder from an existing instance.intcalls()Number of calls, including the initial call and retries, which must be at least1.static RetryConfigcreate()Create a new instance with default values.static RetryConfigCreate a new instance from configuration.delay()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.booleanFlag to enable metrics for this 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.default 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.maxDelay()Optional non-negative maximum delay applied after jitter; when absent, the delay is not capped.name()Name for debugging, error reporting, monitoring.Positive overall timeout used to bound the complete retry sequence.Explicitly configured retry policy.skipOn()These throwables will not be considered retriable, all other will.Methods inherited from interface Prototype.Factory
build
-
Field Details
-
DEFAULT_CALLS
static final int DEFAULT_CALLSDefault calls to make.- See Also:
-
DEFAULT_DELAY
-
DEFAULT_OVERALL_TIMEOUT
-
-
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
-
name
-
calls
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
Duration delay()Non-negative base delay between the initial call and retries, which defaults to200 ms.- Returns:
- delay between retries (combines with retry policy)
-
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.- Returns:
- delay factor for delaying retry policy
-
jitter
Duration 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
default 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
Duration overallTimeout()Positive overall timeout used to bound the complete retry sequence.- Returns:
- overall timeout
-
skipOn
-
applyOn
-
retryPolicy
Optional<Retry.RetryPolicy> 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
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
-