类 BatchRetryTemplate
- java.lang.Object
- org.springframework.batch.core.step.item.BatchRetryTemplate
- 所有已实现的接口:
org.springframework.retry.RetryOperations
public class BatchRetryTemplate extends java.lang.Object implements org.springframework.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. TheRetryState
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 theRetryPolicy
. 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.- 作者:
- Dave Syer
构造器概要
构造器 构造器 说明 BatchRetryTemplate()
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 boolean
canRetry(org.springframework.retry.RetryContext context)
static java.util.List<org.springframework.retry.RetryState>
createState(java.util.List<?> keys)
static java.util.List<org.springframework.retry.RetryState>
createState(java.util.List<?> keys, org.springframework.classify.Classifier<? super java.lang.Throwable,java.lang.Boolean> classifier)
<T,E extends java.lang.Throwable>
Texecute(org.springframework.retry.RetryCallback<T,E> retryCallback)
<T,E extends java.lang.Throwable>
Texecute(org.springframework.retry.RetryCallback<T,E> retryCallback, java.util.Collection<org.springframework.retry.RetryState> states)
<T,E extends java.lang.Throwable>
Texecute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RecoveryCallback<T> recoveryCallback)
<T,E extends java.lang.Throwable>
Texecute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RecoveryCallback<T> recoveryCallback, java.util.Collection<org.springframework.retry.RetryState> states)
<T,E extends java.lang.Throwable>
Texecute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RecoveryCallback<T> recoveryCallback, org.springframework.retry.RetryState retryState)
<T,E extends java.lang.Throwable>
Texecute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RetryState retryState)
void
registerListener(org.springframework.retry.RetryListener listener)
void
setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
void
setListeners(org.springframework.retry.RetryListener[] listeners)
void
setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache)
void
setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)
构造器详细资料
BatchRetryTemplate
public BatchRetryTemplate()
方法详细资料
execute
public <T,E extends java.lang.Throwable> T execute(org.springframework.retry.RetryCallback<T,E> retryCallback, java.util.Collection<org.springframework.retry.RetryState> states) throws E extends java.lang.Throwable, java.lang.Exception
- 抛出:
E extends java.lang.Throwable
java.lang.Exception
execute
public <T,E extends java.lang.Throwable> T execute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RecoveryCallback<T> recoveryCallback, java.util.Collection<org.springframework.retry.RetryState> states) throws E extends java.lang.Throwable, java.lang.Exception
- 抛出:
E extends java.lang.Throwable
java.lang.Exception
execute
public final <T,E extends java.lang.Throwable> T execute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RecoveryCallback<T> recoveryCallback, org.springframework.retry.RetryState retryState) throws E extends java.lang.Throwable
- 指定者:
execute
在接口中org.springframework.retry.RetryOperations
- 抛出:
E extends java.lang.Throwable
execute
public final <T,E extends java.lang.Throwable> T execute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RecoveryCallback<T> recoveryCallback) throws E extends java.lang.Throwable
- 指定者:
execute
在接口中org.springframework.retry.RetryOperations
- 抛出:
E extends java.lang.Throwable
execute
public final <T,E extends java.lang.Throwable> T execute(org.springframework.retry.RetryCallback<T,E> retryCallback, org.springframework.retry.RetryState retryState) throws E extends java.lang.Throwable, org.springframework.retry.ExhaustedRetryException
- 指定者:
execute
在接口中org.springframework.retry.RetryOperations
- 抛出:
E extends java.lang.Throwable
org.springframework.retry.ExhaustedRetryException
execute
public final <T,E extends java.lang.Throwable> T execute(org.springframework.retry.RetryCallback<T,E> retryCallback) throws E extends java.lang.Throwable
- 指定者:
execute
在接口中org.springframework.retry.RetryOperations
- 抛出:
E extends java.lang.Throwable
createState
public static java.util.List<org.springframework.retry.RetryState> createState(java.util.List<?> keys)
createState
public static java.util.List<org.springframework.retry.RetryState> createState(java.util.List<?> keys, org.springframework.classify.Classifier<? super java.lang.Throwable,java.lang.Boolean> classifier)
registerListener
public void registerListener(org.springframework.retry.RetryListener listener)
setBackOffPolicy
public void setBackOffPolicy(org.springframework.retry.backoff.BackOffPolicy backOffPolicy)
setListeners
public void setListeners(org.springframework.retry.RetryListener[] listeners)
setRetryContextCache
public void setRetryContextCache(org.springframework.retry.policy.RetryContextCache retryContextCache)
setRetryPolicy
public void setRetryPolicy(org.springframework.retry.RetryPolicy retryPolicy)
canRetry
public boolean canRetry(org.springframework.retry.RetryContext context)