org.springframework.batch.core.step.item
Class BatchRetryTemplate
java.lang.Object
org.springframework.batch.core.step.item.BatchRetryTemplate
- All Implemented Interfaces:
- org.springframework.batch.retry.RetryOperations
public class BatchRetryTemplate
- extends java.lang.Object
- implements org.springframework.batch.retry.RetryOperations
A special purpose retry template that deals specifically with multi-valued
stateful retry. This is useful in the case where the operation to be retried
operates on multiple items, and when it fails there is no way to decide which
(if any) of the items was responsible. The RetryState used in the
execute methods is composite, and when a failure occurs, all of the keys in
the composite are "tarred with the same brush". Subsequent attempts to
execute with any of the keys that have failed previously results in a new
attempt and the previous state is used to check the RetryPolicy. If
one of the failed items eventually succeeds then the others in the current
composite for that attempt will be cleared from the context cache (as
normal), but there may still be entries in the cache for the original failed
items. This might mean that an item that did not cause a failure is never
retried because other items in the same batch fail fatally first.
- Author:
- Dave Syer
|
Method Summary |
static java.util.List<org.springframework.batch.retry.RetryState> |
createState(java.util.List<?> keys)
|
static java.util.List<org.springframework.batch.retry.RetryState> |
createState(java.util.List<?> keys,
org.springframework.batch.classify.Classifier<? super java.lang.Throwable,java.lang.Boolean> classifier)
|
|
execute(org.springframework.batch.retry.RetryCallback<T> retryCallback)
|
|
execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
java.util.Collection<org.springframework.batch.retry.RetryState> states)
|
|
execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RecoveryCallback<T> recoveryCallback)
|
|
execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RecoveryCallback<T> recoveryCallback,
java.util.Collection<org.springframework.batch.retry.RetryState> states)
|
|
execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RecoveryCallback<T> recoveryCallback,
org.springframework.batch.retry.RetryState retryState)
|
|
execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RetryState retryState)
|
void |
registerListener(org.springframework.batch.retry.RetryListener listener)
|
void |
setBackOffPolicy(org.springframework.batch.retry.backoff.BackOffPolicy backOffPolicy)
|
void |
setListeners(org.springframework.batch.retry.RetryListener[] listeners)
|
void |
setRetryContextCache(org.springframework.batch.retry.policy.RetryContextCache retryContextCache)
|
void |
setRetryPolicy(org.springframework.batch.retry.RetryPolicy retryPolicy)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BatchRetryTemplate
public BatchRetryTemplate()
execute
public <T> T execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
java.util.Collection<org.springframework.batch.retry.RetryState> states)
throws org.springframework.batch.retry.ExhaustedRetryException,
java.lang.Exception
- Throws:
org.springframework.batch.retry.ExhaustedRetryException
java.lang.Exception
execute
public <T> T execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RecoveryCallback<T> recoveryCallback,
java.util.Collection<org.springframework.batch.retry.RetryState> states)
throws org.springframework.batch.retry.ExhaustedRetryException,
java.lang.Exception
- Throws:
org.springframework.batch.retry.ExhaustedRetryException
java.lang.Exception
execute
public final <T> T execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RecoveryCallback<T> recoveryCallback,
org.springframework.batch.retry.RetryState retryState)
throws java.lang.Exception,
org.springframework.batch.retry.ExhaustedRetryException
- Specified by:
execute in interface org.springframework.batch.retry.RetryOperations
- Throws:
java.lang.Exception
org.springframework.batch.retry.ExhaustedRetryException
execute
public final <T> T execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RecoveryCallback<T> recoveryCallback)
throws java.lang.Exception
- Specified by:
execute in interface org.springframework.batch.retry.RetryOperations
- Throws:
java.lang.Exception
execute
public final <T> T execute(org.springframework.batch.retry.RetryCallback<T> retryCallback,
org.springframework.batch.retry.RetryState retryState)
throws java.lang.Exception,
org.springframework.batch.retry.ExhaustedRetryException
- Specified by:
execute in interface org.springframework.batch.retry.RetryOperations
- Throws:
java.lang.Exception
org.springframework.batch.retry.ExhaustedRetryException
execute
public final <T> T execute(org.springframework.batch.retry.RetryCallback<T> retryCallback)
throws java.lang.Exception
- Specified by:
execute in interface org.springframework.batch.retry.RetryOperations
- Throws:
java.lang.Exception
createState
public static java.util.List<org.springframework.batch.retry.RetryState> createState(java.util.List<?> keys)
createState
public static java.util.List<org.springframework.batch.retry.RetryState> createState(java.util.List<?> keys,
org.springframework.batch.classify.Classifier<? super java.lang.Throwable,java.lang.Boolean> classifier)
registerListener
public void registerListener(org.springframework.batch.retry.RetryListener listener)
setBackOffPolicy
public void setBackOffPolicy(org.springframework.batch.retry.backoff.BackOffPolicy backOffPolicy)
setListeners
public void setListeners(org.springframework.batch.retry.RetryListener[] listeners)
setRetryContextCache
public void setRetryContextCache(org.springframework.batch.retry.policy.RetryContextCache retryContextCache)
setRetryPolicy
public void setRetryPolicy(org.springframework.batch.retry.RetryPolicy retryPolicy)
Copyright © 2009. All Rights Reserved.