Package io.helidon.config
Class RetryPolicies.Builder
- java.lang.Object
-
- io.helidon.config.RetryPolicies.Builder
-
- All Implemented Interfaces:
Builder<RetryPolicy>
,Supplier<RetryPolicy>
- Enclosing class:
- RetryPolicies
public static final class RetryPolicies.Builder extends Object implements Builder<RetryPolicy>
A builder of the defaultRetryPolicy
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RetryPolicy
build()
Builds a new execute policy.RetryPolicies.Builder
callTimeout(Duration callTimeout)
Sets a limit for each invocation.static RetryPolicies.Builder
create(Config metaConfig)
Initializes retry policy instance from configuration properties.RetryPolicies.Builder
delay(Duration delay)
Sets an initial delay between invocations, that is repeatedly multiplied bydelayFactor
.RetryPolicies.Builder
delayFactor(double delayFactor)
Sets a factor that prolongs the delay for an every new execute.RetryPolicies.Builder
executor(ScheduledExecutorService executorService)
Sets a customexecutor
used to invoke a method call.RetryPolicy
get()
RetryPolicies.Builder
overallTimeout(Duration overallTimeout)
Sets a overall limit for all invocation, including delays.
-
-
-
Method Detail
-
create
public static RetryPolicies.Builder create(Config metaConfig) throws ConfigMappingException, MissingValueException
Initializes retry policy instance from configuration properties.Mandatory
properties
, seeRetryPolicies.repeat(int)
:retries
- typeint
properties
:delay
- typeDuration
, seedelay(Duration)
delay-factor
- typedouble
, seedelayFactor(double)
call-timeout
- typeDuration
, seecallTimeout(Duration)
overall-timeout
- typeDuration
, seeoverallTimeout(Duration)
- Parameters:
metaConfig
- meta-configuration used to initialize returned polling strategy builder instance from.- Returns:
- new instance of polling strategy builder described by
metaConfig
- Throws:
MissingValueException
- in case the configuration tree does not contain all expected sub-nodes required by the mapper implementation to provide instance of Java type.ConfigMappingException
- in case the mapper fails to map the (existing) configuration tree represented by the supplied configuration node to an instance of a given Java type.- See Also:
PollingStrategies.regular(Duration)
-
delay
public RetryPolicies.Builder delay(Duration delay)
Sets an initial delay between invocations, that is repeatedly multiplied bydelayFactor
.The default value is 200ms.
- Parameters:
delay
- an overall timeout- Returns:
- a modified builder instance
-
delayFactor
public RetryPolicies.Builder delayFactor(double delayFactor)
Sets a factor that prolongs the delay for an every new execute.The default value is 2.
- Parameters:
delayFactor
- a delay prolonging factor- Returns:
- a modified builder instance
-
callTimeout
public RetryPolicies.Builder callTimeout(Duration callTimeout)
Sets a limit for each invocation.The default value is 500ms.
- Parameters:
callTimeout
- an invocation timeout - a limit per call- Returns:
- a modified builder instance
-
overallTimeout
public RetryPolicies.Builder overallTimeout(Duration overallTimeout)
Sets a overall limit for all invocation, including delays.The default value is 2s.
- Parameters:
overallTimeout
- an overall timeout- Returns:
- a modified builder instance
-
executor
public RetryPolicies.Builder executor(ScheduledExecutorService executorService)
Sets a customexecutor
used to invoke a method call.By default single-threaded executor is used.
- Parameters:
executorService
- the custom scheduled executor service- Returns:
- a modified builder instance
-
build
public RetryPolicy build()
Builds a new execute policy.- Specified by:
build
in interfaceBuilder<RetryPolicy>
- Returns:
- the new instance
-
get
public RetryPolicy get()
- Specified by:
get
in interfaceBuilder<RetryPolicy>
- Specified by:
get
in interfaceSupplier<RetryPolicy>
-
-