|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.retry.policy.SimpleRetryPolicy
public class SimpleRetryPolicy
Simple retry policy that retries a fixed number of times for a set of named exceptions (and subclasses). The number of attempts includes the initial try, so e.g.
retryTemplate = new RetryTemplate(new SimpleRetryPolicy(3)); retryTemplate.execute(callback);will execute the callback at least once, and as many as 3 times.
| Field Summary | |
|---|---|
static int |
DEFAULT_MAX_ATTEMPTS
The default limit to the number of attempts for a new policy. |
| Constructor Summary | |
|---|---|
SimpleRetryPolicy()
Create a SimpleRetryPolicy with the default number of retry
attempts. |
|
SimpleRetryPolicy(int maxAttempts)
Create a SimpleRetryPolicy with the specified number of retry
attempts, and default exceptions to retry. |
|
| Method Summary | |
|---|---|
boolean |
canRetry(RetryContext context)
Test for retryable operation based on the status. |
void |
close(RetryContext status)
|
RetryContext |
open(RetryContext parent)
Get a status object that can be used to track the current operation according to this policy. |
void |
registerThrowable(RetryContext context,
java.lang.Exception throwable)
Update the status with another attempted retry and the latest exception. |
void |
setFatalExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
Set the fatal exceptions. |
void |
setMaxAttempts(int retryAttempts)
Setter for retry attempts. |
void |
setRetryableExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> retryableExceptionClasses)
Set the retryable exceptions. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_MAX_ATTEMPTS
| Constructor Detail |
|---|
public SimpleRetryPolicy()
SimpleRetryPolicy with the default number of retry
attempts.
public SimpleRetryPolicy(int maxAttempts)
SimpleRetryPolicy with the specified number of retry
attempts, and default exceptions to retry.
maxAttempts - number of allowed attempts (typically >= 1)| Method Detail |
|---|
public void setMaxAttempts(int retryAttempts)
retryAttempts - the number of attempts before a retry becomes
impossible.public boolean canRetry(RetryContext context)
canRetry in interface RetryPolicycontext - the current retry status
RetryPolicy.canRetry(org.springframework.batch.retry.RetryContext)public final void setRetryableExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> retryableExceptionClasses)
retryableExceptionClasses - defaults to Exception.public final void setFatalExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
fatalExceptionClasses - defaults to Exception.public void close(RetryContext status)
close in interface RetryPolicystatus - a retry status created by the
RetryPolicy.open(RetryContext) method of this manager.RetryPolicy.close(RetryContext)
public void registerThrowable(RetryContext context,
java.lang.Exception throwable)
registerThrowable in interface RetryPolicycontext - the current status object.RetryPolicy.registerThrowable(org.springframework.batch.retry.RetryContext,
Exception)public RetryContext open(RetryContext parent)
open in interface RetryPolicyparent - the parent context if we are in a nested retry.
RetryContext object specific to this manager.RetryPolicy.open(RetryContext)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||