类 SimpleLimitExceptionHandler

  • 所有已实现的接口:
    ExceptionHandler, org.springframework.beans.factory.InitializingBean

    public class SimpleLimitExceptionHandler
    extends java.lang.Object
    implements ExceptionHandler, org.springframework.beans.factory.InitializingBean
    Simple implementation of exception handler which looks for given exception types. If one of the types is found then a counter is incremented and the limit is checked to determine if it has been exceeded and the Throwable should be re-thrown. Also allows to specify list of 'fatal' exceptions that are never subject to counting, but are immediately re-thrown. The fatal list has higher priority so the two lists needn't be exclusive.
    作者:
    Dave Syer, Robert Kasanicky
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型方法说明
      voidafterPropertiesSet()
      Apply the provided properties to create a delegate handler.
      voidhandleException​(RepeatContext context, java.lang.Throwable throwable)
      Rethrows only if the limit is breached for this context on the exception type specified.
      voidsetExceptionClasses​(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> classes)
      Setter for the exception classes that this handler counts.
      voidsetFatalExceptionClasses​(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
      Setter for the exception classes that shouldn't be counted, but rethrown immediately.
      voidsetLimit​(int limit)
      The limit on the given exception type within a single context before it is rethrown.
      voidsetUseParent​(boolean useParent)
      Flag to indicate the the exception counters should be shared between sibling contexts in a nested batch (i.e. inner loop).
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 方法详细资料

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Apply the provided properties to create a delegate handler.
        指定者:
        afterPropertiesSet 在接口中 org.springframework.beans.factory.InitializingBean
        抛出:
        java.lang.Exception
        另请参阅:
        InitializingBean.afterPropertiesSet()
      • setUseParent

        public void setUseParent​(boolean useParent)
        Flag to indicate the the exception counters should be shared between sibling contexts in a nested batch (i.e. inner loop). Default is false. Set this flag to true if you want to count exceptions for the whole (outer) loop in a typical container.
        参数:
        useParent - true if the parent context should be used to store the counters.
      • setLimit

        public void setLimit​(int limit)
        The limit on the given exception type within a single context before it is rethrown.
        参数:
        limit - the limit
      • setExceptionClasses

        public void setExceptionClasses​(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> classes)
        Setter for the exception classes that this handler counts. Defaults to Exception. If more exceptionClasses are specified handler uses single counter that is incremented when one of the recognized exception exceptionClasses is handled.
        参数:
        classes - exceptionClasses
      • setFatalExceptionClasses

        public void setFatalExceptionClasses​(java.util.Collection<java.lang.Class<? extends java.lang.Throwable>> fatalExceptionClasses)
        Setter for the exception classes that shouldn't be counted, but rethrown immediately. This list has higher priority than setExceptionClasses(Collection).
        参数:
        fatalExceptionClasses - defaults to Error