类 LimitCheckingItemSkipPolicy

  • 所有已实现的接口:
    SkipPolicy

    public class LimitCheckingItemSkipPolicy
    extends java.lang.Object
    implements SkipPolicy

    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. A Classifier is used to determine whether a particular exception is skippable or not.

    作者:
    Ben Hale, Lucas Ward, Robert Kasanicky, Dave Syer, Dan Garrette
    • 构造器概要

      构造器 
      构造器说明
      LimitCheckingItemSkipPolicy()
      Convenience constructor that assumes all exception types are fatal.
      LimitCheckingItemSkipPolicy​(int skipLimit, java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> skippableExceptions) 
      LimitCheckingItemSkipPolicy​(int skipLimit, org.springframework.classify.Classifier<java.lang.Throwable,​java.lang.Boolean> skippableExceptionClassifier) 
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型方法说明
      voidsetSkipLimit​(int skipLimit)
      The absolute number of skips (of skippable exceptions) that can be tolerated before a failure.
      voidsetSkippableExceptionClassifier​(org.springframework.classify.Classifier<java.lang.Throwable,​java.lang.Boolean> skippableExceptionClassifier)
      The classifier that will be used to decide on skippability.
      voidsetSkippableExceptionMap​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> skippableExceptions)
      Set up the classifier through a convenient map from throwable class to boolean (true if skippable).
      booleanshouldSkip​(java.lang.Throwable t, int skipCount)
      Given the provided exception and skip count, determine whether or not processing should continue for the given exception.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • LimitCheckingItemSkipPolicy

        public LimitCheckingItemSkipPolicy​(int skipLimit,
                                           java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> skippableExceptions)
        参数:
        skipLimit - the number of skippable exceptions that are allowed to be skipped
        skippableExceptions - exception classes that can be skipped (non-critical)
      • LimitCheckingItemSkipPolicy

        public LimitCheckingItemSkipPolicy​(int skipLimit,
                                           org.springframework.classify.Classifier<java.lang.Throwable,​java.lang.Boolean> skippableExceptionClassifier)
        参数:
        skipLimit - the number of skippable exceptions that are allowed to be skipped
        skippableExceptionClassifier - exception classifier for those that can be skipped (non-critical)
    • 方法详细资料

      • setSkipLimit

        public void setSkipLimit​(int skipLimit)
        The absolute number of skips (of skippable exceptions) that can be tolerated before a failure.
        参数:
        skipLimit - the skip limit to set
      • setSkippableExceptionClassifier

        public void setSkippableExceptionClassifier​(org.springframework.classify.Classifier<java.lang.Throwable,​java.lang.Boolean> skippableExceptionClassifier)
        The classifier that will be used to decide on skippability. If an exception classifies as "true" then it is skippable, and otherwise not.
        参数:
        skippableExceptionClassifier - the skippableExceptionClassifier to set
      • setSkippableExceptionMap

        public void setSkippableExceptionMap​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> skippableExceptions)
        Set up the classifier through a convenient map from throwable class to boolean (true if skippable).
        参数:
        skippableExceptions - the skippable exceptions to set
      • shouldSkip

        public 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. If the exception is not classified as skippable in the classifier, false will be returned. If the exception is classified as skippable and StepExecution skipCount is greater than the skipLimit, then a SkipLimitExceededException will be thrown.
        指定者:
        shouldSkip 在接口中 SkipPolicy
        参数:
        t - exception encountered while processing
        skipCount - currently running count of skips
        返回:
        true if processing should continue, false otherwise.