Class ExceptionClassifier

    • Constructor Summary

      Constructors 
      Constructor Description
      ExceptionClassifier()
      Construct the instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addNotRetryableExceptions​(java.lang.Class<? extends java.lang.Exception>... exceptionTypes)
      Add exception types to the default list.
      void addRetryableExceptions​(java.lang.Class<? extends java.lang.Exception>... exceptionTypes)
      Add exception types that can be retried.
      void defaultFalse()
      By default, unmatched types classify as true.
      protected org.springframework.classify.BinaryExceptionClassifier getClassifier()
      Return the exception classifier.
      java.lang.Boolean removeClassification​(java.lang.Class<? extends java.lang.Exception> exceptionType)
      Remove an exception type from the configured list.
      boolean removeNotRetryableException​(java.lang.Class<? extends java.lang.Exception> exceptionType)
      Deprecated.
      void setClassifications​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> classifications, boolean defaultValue)
      Set an exception classifications to determine whether the exception should cause a retry (until exhaustion) or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExceptionClassifier

        public ExceptionClassifier()
        Construct the instance.
    • Method Detail

      • defaultFalse

        public void defaultFalse()
        By default, unmatched types classify as true. Call this method to make the default false, and remove types explicitly classified as false. This should be called before calling any of the classification modification methods.
        Since:
        2.8.4
      • getClassifier

        protected org.springframework.classify.BinaryExceptionClassifier getClassifier()
        Return the exception classifier.
        Returns:
        the classifier.
      • setClassifications

        public void setClassifications​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​java.lang.Boolean> classifications,
                                       boolean defaultValue)
        Set an exception classifications to determine whether the exception should cause a retry (until exhaustion) or not. If not, we go straight to the recoverer. By default, the following exceptions will not be retried:
        • DeserializationException
        • MessageConversionException
        • MethodArgumentResolutionException
        • NoSuchMethodException
        • ClassCastException
        All others will be retried. When calling this method, the defaults will not be applied.
        Parameters:
        classifications - the classifications.
        defaultValue - whether or not to retry non-matching exceptions.
        See Also:
        BinaryExceptionClassifier(Map, boolean), addNotRetryableExceptions(Class...)
      • addNotRetryableExceptions

        @SafeVarargs
        public final void addNotRetryableExceptions​(java.lang.Class<? extends java.lang.Exception>... exceptionTypes)
        Add exception types to the default list. By default, the following exceptions will not be retried: All others will be retried, unless defaultFalse() has been called.
        Parameters:
        exceptionTypes - the exception types.
        See Also:
        removeClassification(Class), setClassifications(Map, boolean)
      • addRetryableExceptions

        @SafeVarargs
        public final void addRetryableExceptions​(java.lang.Class<? extends java.lang.Exception>... exceptionTypes)
        Add exception types that can be retried. Call this after defaultFalse() to specify those exception types that should be classified as true. All others will be retried, unless defaultFalse() has been called.
        Parameters:
        exceptionTypes - the exception types.
        Since:
        2.8.4
        See Also:
        removeClassification(Class), setClassifications(Map, boolean)
      • removeClassification

        @Nullable
        public java.lang.Boolean removeClassification​(java.lang.Class<? extends java.lang.Exception> exceptionType)
        Remove an exception type from the configured list. By default, the following exceptions will not be retried: All others will be retried, unless defaultFalse() has been called.
        Parameters:
        exceptionType - the exception type.
        Returns:
        the classification of the exception if removal was successful; null otherwise.
        Since:
        2.8.4
        See Also:
        addNotRetryableExceptions(Class...), setClassifications(Map, boolean)