|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy
public class LimitCheckingItemSkipPolicy
ItemSkipPolicy
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 FlatFileParseException
s,
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 must be 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,
List skippableExceptions,
List fatalExceptions)
|
Method Summary | |
---|---|
boolean |
shouldSkip(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 skippublic LimitCheckingItemSkipPolicy(int skipLimit, List skippableExceptions, List 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 skippedMethod Detail |
---|
public boolean shouldSkip(Throwable t, int skipCount)
StepExecution
skipCount is greater than the skipLimit, then a
SkipLimitExceededException
will be thrown.
shouldSkip
in interface ItemSkipPolicy
t
- 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 |