java.util.function.Supplier<RetryPolicy>
public static class RetryPolicies.Builder extends java.lang.Object implements java.util.function.Supplier<RetryPolicy>
RetryPolicy
.Modifier and Type | Method | Description |
---|---|---|
RetryPolicy |
build() |
Builds a new execute policy.
|
RetryPolicies.Builder |
callTimeout(java.time.Duration callTimeout) |
Sets a limit for each invocation.
|
RetryPolicies.Builder |
delay(java.time.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(java.util.concurrent.ScheduledExecutorService executorService) |
Sets a custom
executor used to invoke a method call. |
static RetryPolicies.Builder |
from(Config metaConfig) |
Initializes retry policy instance from configuration properties.
|
RetryPolicy |
get() |
|
RetryPolicies.Builder |
overallTimeout(java.time.Duration overallTimeout) |
Sets a overall limit for all invocation, including delays.
|
public static RetryPolicies.Builder from(Config metaConfig) throws ConfigMappingException, MissingValueException
Mandatory properties
, see RetryPolicies.repeat(int)
:
retries
- type int
properties
:
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.metaConfig
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.PollingStrategies.regular(Duration)
public RetryPolicies.Builder delay(java.time.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(java.time.Duration callTimeout)
The default value is 500ms.
callTimeout
- an invocation timeout - a limit per callpublic RetryPolicies.Builder overallTimeout(java.time.Duration overallTimeout)
The default value is 2s.
overallTimeout
- an overall timeoutpublic RetryPolicies.Builder executor(java.util.concurrent.ScheduledExecutorService executorService)
executor
used to invoke a method call.
By default single-threaded executor is used.
executorService
- the custom scheduled executor servicepublic RetryPolicy build()
public RetryPolicy get()
get
in interface java.util.function.Supplier<RetryPolicy>
Copyright © 2018 Oracle Corporation. All rights reserved.