public final class RetryStrategies extends Object
RetryStrategy implementation.| Modifier and Type | Method and Description |
|---|---|
static RetryStrategy |
exponentialDelay(long baseDelay,
long maxDelay,
TimeUnit delayUnit)
Creates a
RetryStrategy that will increase delay exponentially between each retries. |
static RetryStrategy |
fixDelay(long delay,
TimeUnit delayUnit)
Creates a
RetryStrategy that imposes a fix delay between each retries. |
static RetryStrategy |
limit(int limit,
RetryStrategy strategy)
Creates a
RetryStrategy that retries maximum given number of times, with the actual
delay behavior delegated to another RetryStrategy. |
static RetryStrategy |
noRetry() |
static RetryStrategy |
timeLimit(long maxElapseTime,
TimeUnit timeUnit,
RetryStrategy strategy)
Creates a
RetryStrategy that will retry until maximum amount of time has been passed since the request,
with the actual delay behavior delegated to another RetryStrategy. |
public static RetryStrategy noRetry()
RetryStrategy that doesn't do any retry.public static RetryStrategy limit(int limit, RetryStrategy strategy)
RetryStrategy that retries maximum given number of times, with the actual
delay behavior delegated to another RetryStrategy.limit - Maximum number of retries allowed.strategy - When failure count is less than or equal to the limit, this strategy will be called.RetryStrategy.public static RetryStrategy fixDelay(long delay, TimeUnit delayUnit)
RetryStrategy that imposes a fix delay between each retries.delay - delay timedelayUnit - TimeUnit for the delay.RetryStrategy.public static RetryStrategy exponentialDelay(long baseDelay, long maxDelay, TimeUnit delayUnit)
RetryStrategy that will increase delay exponentially between each retries.baseDelay - delay to start with.maxDelay - cap of the delay.delayUnit - TimeUnit for the delays.RetryStrategy.public static RetryStrategy timeLimit(long maxElapseTime, TimeUnit timeUnit, RetryStrategy strategy)
RetryStrategy that will retry until maximum amount of time has been passed since the request,
with the actual delay behavior delegated to another RetryStrategy.maxElapseTime - Maximum amount of time until giving up retry.timeUnit - TimeUnit for the max elapse time.strategy - When time elapsed is less than or equal to the limit, this strategy will be called.RetryStrategy.Copyright © 2013-2016 The Apache Software Foundation. All rights reserved.