public class TimeoutRetryPolicy extends Object implements RetryPolicy
RetryPolicy
that allows a retry only if it hasn't timed out. The
clock is started on a call to open(RetryContext)
.Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_TIMEOUT
Default value for timeout (milliseconds).
|
Constructor and Description |
---|
TimeoutRetryPolicy() |
Modifier and Type | Method and Description |
---|---|
boolean |
canRetry(RetryContext context)
Only permits a retry if the timeout has not expired.
|
void |
close(RetryContext context) |
long |
getTimeout()
The value of the timeout.
|
RetryContext |
open(RetryContext parent)
Acquire resources needed for the retry operation.
|
void |
registerThrowable(RetryContext context,
Throwable throwable)
Called once per retry attempt, after the callback fails.
|
void |
setTimeout(long timeout)
Setter for timeout in milliseconds.
|
public static final long DEFAULT_TIMEOUT
public void setTimeout(long timeout)
DEFAULT_TIMEOUT
.timeout
- how long to wait until a timeoutpublic long getTimeout()
public boolean canRetry(RetryContext context)
canRetry
in interface RetryPolicy
context
- the current retry statusRetryPolicy.canRetry(org.springframework.retry.RetryContext)
public void close(RetryContext context)
close
in interface RetryPolicy
context
- a retry status created by the
RetryPolicy.open(RetryContext)
method of this policy.public RetryContext open(RetryContext parent)
RetryPolicy
open
in interface RetryPolicy
parent
- the parent context if we are in a nested retry.RetryContext
object specific to this policy.public void registerThrowable(RetryContext context, Throwable throwable)
RetryPolicy
registerThrowable
in interface RetryPolicy
context
- the current status object.throwable
- the exception to throwCopyright © 2018 SpringSource. All rights reserved.