public static final class RetryPolicies.Builder extends Object implements Builder<RetryPolicy>
RetryPolicy.| Modifier and Type | Method and 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 by
delayFactor. |
RetryPolicies.Builder |
delayFactor(double delayFactor)
Sets a factor that prolongs the delay for an every new execute.
|
RetryPolicies.Builder |
executor(ScheduledExecutorService executorService)
Sets a custom
executor used to invoke a method call. |
RetryPolicy |
get() |
RetryPolicies.Builder |
overallTimeout(Duration overallTimeout)
Sets a overall limit for all invocation, including delays.
|
public static RetryPolicies.Builder create(Config metaConfig) throws ConfigMappingException, MissingValueException
Mandatory properties, see RetryPolicies.repeat(int):
retries - type intproperties:
delay - type Duration, see delay(Duration)delay-factor - type double, see delayFactor(double)call-timeout - type Duration, see callTimeout(Duration)overall-timeout - type Duration, see overallTimeout(Duration)metaConfig - meta-configuration used to initialize returned polling strategy builder instance from.metaConfigMissingValueException - 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.PollingStrategies.regular(Duration)public RetryPolicies.Builder delay(Duration delay)
delayFactor.
The default value is 200ms.
delay - an overall timeoutpublic RetryPolicies.Builder delayFactor(double delayFactor)
The default value is 2.
delayFactor - a delay prolonging factorpublic RetryPolicies.Builder callTimeout(Duration callTimeout)
The default value is 500ms.
callTimeout - an invocation timeout - a limit per callpublic RetryPolicies.Builder overallTimeout(Duration overallTimeout)
The default value is 2s.
overallTimeout - an overall timeoutpublic RetryPolicies.Builder executor(ScheduledExecutorService executorService)
executor used to invoke a method call.
By default single-threaded executor is used.
executorService - the custom scheduled executor servicepublic RetryPolicy build()
build in interface Builder<RetryPolicy>public RetryPolicy get()
get in interface Builder<RetryPolicy>get in interface Supplier<RetryPolicy>Copyright © 2018–2019 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.