Class StatefulRetryStepFactoryBean

  extended by org.springframework.batch.core.step.item.AbstractStepFactoryBean
      extended by org.springframework.batch.core.step.item.SimpleStepFactoryBean
          extended by org.springframework.batch.core.step.item.SkipLimitStepFactoryBean
              extended by org.springframework.batch.core.step.item.StatefulRetryStepFactoryBean
All Implemented Interfaces:
BeanNameAware, FactoryBean

public class StatefulRetryStepFactoryBean
extends SkipLimitStepFactoryBean

Factory bean for step that executes its item processing with a stateful retry. Failed items are never skipped, but always cause a rollback. Before a rollback, the Step makes a record of the failed item, caching it under a key given by the ItemKeyGenerator. Then when it is re-presented by the ItemReader it is recognised and retried up to a limit given by the RetryPolicy. When the retry is exhausted instead of the item being skipped it is handled by an ItemRecoverer.
The skipLimit property is still used to control the overall exception handling policy. Only exhausted retries count against the exception handler, instead of counting all exceptions.
This class is not designed for extension. Do not subclass it.

Dave Syer

Constructor Summary
Method Summary
protected  void applyConfiguration(ItemOrientedStep step)
          Uses the SkipLimitStepFactoryBean.setSkipLimit(int) value to configure item handler and and exception handler.
 void setBackOffPolicy(BackOffPolicy backOffPolicy)
          Public setter for the BackOffPolicy.
 void setItemRecoverer(ItemRecoverer itemRecoverer)
          Public setter for the ItemRecoverer.
 void setRetryableExceptionClasses(Class[] retryableExceptionClasses)
          Public setter for the Class[].
 void setRetryLimit(int retryLimit)
          Public setter for the retry limit.
 void setRetryListeners(RetryListener[] retryListeners)
          Public setter for the RetryListeners.
Methods inherited from class org.springframework.batch.core.step.item.SkipLimitStepFactoryBean
addFatalExceptionIfMissing, getFatalExceptionClasses, getItemKeyGenerator, getItemSkipPolicy, setFatalExceptionClasses, setItemKeyGenerator, setSkipCacheCapacity, setSkipLimit, setSkippableExceptionClasses
Methods inherited from class org.springframework.batch.core.step.item.SimpleStepFactoryBean
getChunkOperations, getExceptionHandler, getItemHandler, getListeners, getStepOperations, setCommitInterval, setExceptionHandler, setItemHandler, setListeners, setStreams, setTaskExecutor
Methods inherited from class org.springframework.batch.core.step.item.AbstractStepFactoryBean
getItemReader, getItemWriter, getName, getObject, getObjectType, isSingleton, setAllowStartIfComplete, setBeanName, setItemReader, setItemWriter, setJobRepository, setSingleton, setStartLimit, setTransactionManager
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public StatefulRetryStepFactoryBean()
Method Detail


public void setRetryLimit(int retryLimit)
Public setter for the retry limit. Each item can be retried up to this limit.

retryLimit - the retry limit to set


public void setRetryableExceptionClasses(Class[] retryableExceptionClasses)
Public setter for the Class[].

retryableExceptionClasses - the retryableExceptionClasses to set


public void setBackOffPolicy(BackOffPolicy backOffPolicy)
Public setter for the BackOffPolicy.

backOffPolicy - the BackOffPolicy to set


public void setRetryListeners(RetryListener[] retryListeners)
Public setter for the RetryListeners.

retryListeners - the RetryListeners to set


public void setItemRecoverer(ItemRecoverer itemRecoverer)
Public setter for the ItemRecoverer. If this is set the ItemRecoverer.recover(Object, Throwable) will be called when retry is exhausted, and within the business transaction (which will not roll back because of any other item-related errors).

itemRecoverer - the ItemRecoverer to set


protected void applyConfiguration(ItemOrientedStep step)
Description copied from class: SkipLimitStepFactoryBean
Uses the SkipLimitStepFactoryBean.setSkipLimit(int) value to configure item handler and and exception handler.

applyConfiguration in class SkipLimitStepFactoryBean
step -

Copyright © 2008 SpringSource. All Rights Reserved.