org.springframework.batch.core.step.item
Class StatefulRetryStepFactoryBean

java.lang.Object
  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.

Author:
Dave Syer

Constructor Summary
StatefulRetryStepFactoryBean()
           
 
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

StatefulRetryStepFactoryBean

public StatefulRetryStepFactoryBean()
Method Detail

setRetryLimit

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

Parameters:
retryLimit - the retry limit to set

setRetryableExceptionClasses

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

Parameters:
retryableExceptionClasses - the retryableExceptionClasses to set

setBackOffPolicy

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

Parameters:
backOffPolicy - the BackOffPolicy to set

setRetryListeners

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

Parameters:
retryListeners - the RetryListeners to set

setItemRecoverer

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).

Parameters:
itemRecoverer - the ItemRecoverer to set

applyConfiguration

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

Overrides:
applyConfiguration in class SkipLimitStepFactoryBean
Parameters:
step -


Copyright © 2008 SpringSource. All Rights Reserved.