|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.retry.policy.AbstractStatefulRetryPolicy org.springframework.batch.retry.policy.RecoveryCallbackRetryPolicy
public class RecoveryCallbackRetryPolicy
A RetryPolicy
that detects an RecoveryRetryCallback
when it
opens a new context, and uses it to make sure the item is in place for later
decisions about how to retry or backoff. The callback should be an instance
of RecoveryRetryCallback
otherwise an exception will be thrown when
the context is created.
Field Summary | |
---|---|
static String |
EXHAUSTED
|
protected org.apache.commons.logging.Log |
logger
|
Fields inherited from class org.springframework.batch.retry.policy.AbstractStatefulRetryPolicy |
---|
retryContextCache |
Constructor Summary | |
---|---|
RecoveryCallbackRetryPolicy()
Default constructor. |
|
RecoveryCallbackRetryPolicy(RetryPolicy delegate)
Convenience constructor to set delegate on init. |
Method Summary | |
---|---|
boolean |
canRetry(RetryContext context)
Check the history of this item, and if it has reached the retry limit, then return false. |
void |
close(RetryContext context)
Delegates to the delegate context. |
Object |
handleRetryExhausted(RetryContext context)
Call recovery path (if any) and clean up context history. |
RetryContext |
open(RetryCallback callback,
RetryContext parent)
Create a new context for the execution of the callback, which must be an instance of RecoveryRetryCallback . |
void |
registerThrowable(RetryContext context,
Throwable throwable)
If canRetry(RetryContext) is false then take remedial action (if
implemented by subclasses), and remove the current item from the history. |
void |
setDelegate(RetryPolicy delegate)
Setter for delegate. |
Methods inherited from class org.springframework.batch.retry.policy.AbstractStatefulRetryPolicy |
---|
recoverForException, setRecoverableExceptionClasses, setRetryContextCache, shouldRethrow |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.apache.commons.logging.Log logger
public static final String EXHAUSTED
Constructor Detail |
---|
public RecoveryCallbackRetryPolicy(RetryPolicy delegate)
delegate
- public RecoveryCallbackRetryPolicy()
SimpleRetryPolicy
for the
delegate.
Method Detail |
---|
public void setDelegate(RetryPolicy delegate)
delegate
- public boolean canRetry(RetryContext context)
context
- the current retry status
RetryPolicy.canRetry(org.springframework.batch.retry.RetryContext)
public void close(RetryContext context)
context
- a retry status created by the RetryPolicy.open(RetryCallback, RetryContext)
method of this manager.RetryPolicy.close(org.springframework.batch.retry.RetryContext)
public RetryContext open(RetryCallback callback, RetryContext parent)
RecoveryRetryCallback
.
callback
- the RetryCallback
that will execute the unit of
work for this retry.parent
- the parent context if we are in a nested retry.
RetryContext
object specific to this manager.
IllegalStateException
- if the callback is not of the required
type.RetryPolicy.open(org.springframework.batch.retry.RetryCallback,
RetryContext)
public void registerThrowable(RetryContext context, Throwable throwable) throws TerminatedRetryException
canRetry(RetryContext)
is false then take remedial action (if
implemented by subclasses), and remove the current item from the history.
context
- the current status object.
TerminatedRetryException
- if the status is set to terminate only.RetryPolicy.registerThrowable(org.springframework.batch.retry.RetryContext,
java.lang.Throwable)
public Object handleRetryExhausted(RetryContext context) throws ExhaustedRetryException
handleRetryExhausted
in interface RetryPolicy
handleRetryExhausted
in class AbstractStatefulRetryPolicy
context
- the current retry context.
ExhaustedRetryException
- if there is no recovery path.AbstractStatefulRetryPolicy.handleRetryExhausted(org.springframework.batch.retry.RetryContext)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |