|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.step.item.SimpleStepFactoryBean<T,S>
org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean<T,S>
public class FaultTolerantStepFactoryBean<T,S>
Factory bean for step that provides options for configuring skip behaviour.
User can set setSkipLimit(int) to set how many exceptions of
setSkippableExceptionClasses(Collection) types are tolerated.
setFatalExceptionClasses(Collection) will cause immediate
termination of job - they are treated as higher priority than
setSkippableExceptionClasses(Collection), so the two lists don't
need to be exclusive.
Skippable exceptions on write will by default cause transaction rollback - to
avoid rollback for specific exception class include it in the transaction
attribute as "no rollback for".
SimpleStepFactoryBean| Field Summary |
|---|
| Fields inherited from class org.springframework.batch.core.step.item.SimpleStepFactoryBean |
|---|
logger |
| Constructor Summary | |
|---|---|
FaultTolerantStepFactoryBean()
|
|
| Method Summary | |
|---|---|
protected void |
applyConfiguration(TaskletStep step)
|
protected SimpleChunkProcessor<T,S> |
configureChunkProcessor()
Extension point for creating appropriate ChunkProcessor. |
protected SimpleChunkProvider<T> |
configureChunkProvider()
Extension point for creating appropriate ChunkProvider. |
protected org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> |
getRollbackClassifier()
Convenience method for subclasses to get an exception classifier based on the provided transaction attributes. |
protected org.springframework.transaction.interceptor.TransactionAttribute |
getTransactionAttribute()
Getter for the TransactionAttribute for subclasses only. |
protected void |
registerStreams(TaskletStep step,
org.springframework.batch.item.ItemStream[] streams)
Register the streams with the step. |
void |
setBackOffPolicy(org.springframework.batch.retry.backoff.BackOffPolicy backOffPolicy)
Public setter for the BackOffPolicy. |
void |
setCacheCapacity(int cacheCapacity)
Public setter for the capacity of the cache in the retry policy. |
void |
setFatalExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
Exception classes that are not skippable (but may be retryable). |
void |
setKeyGenerator(KeyGenerator keyGenerator)
The KeyGenerator to use to identify failed items across rollback. |
void |
setNoRollbackExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
Exception classes that are candidates for no rollback. |
void |
setRetryableExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> retryableExceptionClasses)
Public setter for the Class[]. |
void |
setRetryContextCache(org.springframework.batch.retry.policy.RetryContextCache retryContextCache)
Override the default retry context cache for retry of chunk processing. |
void |
setRetryLimit(int retryLimit)
Public setter for the retry limit. |
void |
setRetryListeners(org.springframework.batch.retry.RetryListener... retryListeners)
Public setter for the RetryListeners. |
void |
setRetryPolicy(org.springframework.batch.retry.RetryPolicy retryPolicy)
Setter for the retry policy. |
void |
setSkipLimit(int skipLimit)
A limit that determines skip policy. |
void |
setSkippableExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionClasses)
Exception classes that when raised won't crash the job but will result in the item which handling caused the exception being skipped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FaultTolerantStepFactoryBean()
| Method Detail |
|---|
public void setKeyGenerator(KeyGenerator keyGenerator)
KeyGenerator to use to identify failed items across rollback.
Not used in the case of the
transactional queue flag
being false (the default).
keyGenerator - the KeyGenerator to setpublic void setRetryPolicy(org.springframework.batch.retry.RetryPolicy retryPolicy)
retryPolicy - a stateless RetryPolicypublic void setRetryLimit(int retryLimit)
retryLimit == 1 by default.
retryLimit - the retry limit to set, must be greater or equal to 1.public void setCacheCapacity(int cacheCapacity)
MapRetryContextCache.setRetryContextCache(RetryContextCache) is set directly.
cacheCapacity - the cache capacity to set (greater than 0 else
ignored)public void setRetryContextCache(org.springframework.batch.retry.policy.RetryContextCache retryContextCache)
setCacheCapacity(int) is ignored.
retryContextCache - the RetryContextCache to setpublic void setRetryableExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> retryableExceptionClasses)
retryableExceptionClasses - the retryableExceptionClasses to setpublic void setBackOffPolicy(org.springframework.batch.retry.backoff.BackOffPolicy backOffPolicy)
BackOffPolicy.
backOffPolicy - the BackOffPolicy to setpublic void setRetryListeners(org.springframework.batch.retry.RetryListener... retryListeners)
RetryListeners.
retryListeners - the RetryListeners to setpublic void setSkipLimit(int skipLimit)
skipLimit - the value to set. Default is 0 (never skip).public void setSkippableExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> exceptionClasses)
skip limit as well.
Defaults to all exceptions.
exceptionClasses - defaults to Exceptionpublic void setNoRollbackExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> noRollbackExceptionClasses)
Step
can not honour the no rollback hint in all circumstances, but any
exception on this list is counted as skippable, so even if there has to
be a rollback, then the step will not fail as long as the skip limit is
not breached.
Defaults is empty.
noRollbackExceptionClasses - the exception classes to setpublic void setFatalExceptionClasses(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
fatalExceptionClasses - Error by defaultprotected org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> getRollbackClassifier()
protected org.springframework.transaction.interceptor.TransactionAttribute getTransactionAttribute()
TransactionAttribute for subclasses only.
getTransactionAttribute in class SimpleStepFactoryBean<T,S>protected void applyConfiguration(TaskletStep step)
applyConfiguration in class SimpleStepFactoryBean<T,S>
protected void registerStreams(TaskletStep step,
org.springframework.batch.item.ItemStream[] streams)
registerStreams in class SimpleStepFactoryBean<T,S>step - the TaskletStepstreams - the streams to registerprotected SimpleChunkProvider<T> configureChunkProvider()
SimpleStepFactoryBeanChunkProvider. Return
value must subclass SimpleChunkProvider due to listener
registration.
configureChunkProvider in class SimpleStepFactoryBean<T,S>ChunkProvider configured for fault-tolerance.protected SimpleChunkProcessor<T,S> configureChunkProcessor()
SimpleStepFactoryBeanChunkProcessor. Return
value must subclass SimpleChunkProcessor due to listener
registration.
configureChunkProcessor in class SimpleStepFactoryBean<T,S>ChunkProcessor configured for fault-tolerance.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||