public class TableRetryPolicy
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static interface |
TableRetryPolicy.RetryPredicate
Serializable adapter interface for
Predicate . |
Constructor and Description |
---|
TableRetryPolicy() |
Modifier and Type | Method and Description |
---|---|
org.apache.samza.table.retry.TableRetryPolicy.BackoffType |
getBackoffType() |
double |
getExponentialFactor() |
java.time.Duration |
getExponentialMaxSleep() |
java.time.Duration |
getJitter()
Introduce randomness to the sleepTime time.
|
java.lang.Integer |
getMaxAttempts()
Termination after a fix number of attempts.
|
java.time.Duration |
getMaxDuration()
Termination after a fixed duration.
|
java.time.Duration |
getRandomMax() |
java.time.Duration |
getRandomMin() |
TableRetryPolicy.RetryPredicate |
getRetryPredicate() |
java.time.Duration |
getSleepTime() |
TableRetryPolicy |
withExponentialBackoff(java.time.Duration sleepTime,
java.time.Duration maxSleep,
double factor)
Set the parameters for the exponential backoff policy.
|
TableRetryPolicy |
withFixedBackoff(java.time.Duration sleepTime)
Set the sleepTime time for the fixed backoff policy.
|
TableRetryPolicy |
withJitter(java.time.Duration jitter)
Set the jitter for the backoff policy to provide additional randomness.
|
TableRetryPolicy |
withRandomBackoff(java.time.Duration minSleep,
java.time.Duration maxSleep)
Set the sleepTime time for the random backoff policy.
|
TableRetryPolicy |
withRetryPredicate(TableRetryPolicy.RetryPredicate retryPredicate)
Set the predicate to use for identifying retriable exceptions.
|
TableRetryPolicy |
withStopAfterAttempts(int maxAttempts)
Set maximum number of attempts before terminating the operation.
|
TableRetryPolicy |
withStopAfterDelay(java.time.Duration maxDelay)
Set maximum total delay (sleepTime + execution) before terminating the operation.
|
public TableRetryPolicy withFixedBackoff(java.time.Duration sleepTime)
sleepTime
- sleepTime timepublic TableRetryPolicy withRandomBackoff(java.time.Duration minSleep, java.time.Duration maxSleep)
[minSleep, maxSleep]
minSleep
- lower bound sleepTime timemaxSleep
- upper bound sleepTime timepublic TableRetryPolicy withExponentialBackoff(java.time.Duration sleepTime, java.time.Duration maxSleep, double factor)
maxSleep
and multiplying
successive delays by the factor
.sleepTime
- initial sleepTime timemaxSleep
- upper bound sleepTime timefactor
- exponential factor for backoffpublic TableRetryPolicy withJitter(java.time.Duration jitter)
[0, jitter]
will be added
to each sleepTime time. This applies to FIXED
and EXPONENTIAL
modes only.jitter
- initial sleepTime timepublic TableRetryPolicy withStopAfterAttempts(int maxAttempts)
maxAttempts
- number of attemptspublic TableRetryPolicy withStopAfterDelay(java.time.Duration maxDelay)
maxDelay
- delay timepublic TableRetryPolicy withRetryPredicate(TableRetryPolicy.RetryPredicate retryPredicate)
retryPredicate
- predicate for retriable exception identificationpublic java.time.Duration getSleepTime()
public java.time.Duration getRandomMin()
policyType
is not RANDOM
.public java.time.Duration getRandomMax()
policyType
is not RANDOM
.public double getExponentialFactor()
public java.time.Duration getExponentialMaxSleep()
policyType
is not EXPONENTIAL
.public java.time.Duration getJitter()
public java.lang.Integer getMaxAttempts()
public java.time.Duration getMaxDuration()
public org.apache.samza.table.retry.TableRetryPolicy.BackoffType getBackoffType()
public TableRetryPolicy.RetryPredicate getRetryPredicate()