|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy
public class LimitCheckingItemSkipPolicy
SkipPolicy that determines whether or not reading should continue
based upon how many items have been skipped. This is extremely useful
behavior, as it allows you to skip records, but will throw a
SkipLimitExceededException if a set limit has been exceeded. For
example, it is generally advisable to skip FlatFileParseExceptions,
however, if the vast majority of records are causing exceptions, the file is
likely bad.
Furthermore, it is also likely that you only want to skip certain exceptions.
FlatFileParseException is a good example of an exception you will
likely want to skip, but a FileNotFoundException should cause
immediate termination of the Step. Because it would be impossible for
a general purpose policy to determine all the types of exceptions that should
be skipped from those that shouldn't, two lists are passed in, with all
of the exceptions that are 'fatal' and 'skippable'. The two lists are not
enforced to be exclusive, they are prioritized instead - exceptions that are
fatal will never be skipped, regardless whether the exception can also be
classified as skippable.
| Constructor Summary | |
|---|---|
LimitCheckingItemSkipPolicy(int skipLimit)
Convenience constructor that assumes all exception types are skippable and none are fatal. |
|
LimitCheckingItemSkipPolicy(int skipLimit,
org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> skippableExceptionClassifier,
org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> fatalExceptionClassifier)
|
|
LimitCheckingItemSkipPolicy(int skipLimit,
java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> skippableExceptions,
java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptions)
|
|
| Method Summary | |
|---|---|
boolean |
shouldSkip(java.lang.Throwable t,
int skipCount)
Given the provided exception and skip count, determine whether or not processing should continue for the given exception. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LimitCheckingItemSkipPolicy(int skipLimit)
skipLimit - the number of exceptions allowed to skip
public LimitCheckingItemSkipPolicy(int skipLimit,
java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> skippableExceptions,
java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptions)
skipLimit - the number of skippable exceptions that are allowed to
be skippedskippableExceptions - exception classes that can be skipped
(non-critical)fatalExceptions - exception classes that should never be skipped
public LimitCheckingItemSkipPolicy(int skipLimit,
org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> skippableExceptionClassifier,
org.springframework.batch.classify.Classifier<java.lang.Throwable,java.lang.Boolean> fatalExceptionClassifier)
skipLimit - the number of skippable exceptions that are allowed to
be skippedskippableExceptionClassifier - exception classifier for those that
can be skipped (non-critical)fatalExceptionClassifier - exception classifier for classes that
should never be skipped| Method Detail |
|---|
public boolean shouldSkip(java.lang.Throwable t,
int skipCount)
StepExecution
skipCount is greater than the skipLimit, then a
SkipLimitExceededException will be thrown.
shouldSkip in interface SkipPolicyt - exception encountered while readingskipCount - currently running count of skips
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||