Class ExceptionClassifierSkipPolicy

  • All Implemented Interfaces:
    SkipPolicy

    public class ExceptionClassifierSkipPolicy
    extends java.lang.Object
    implements SkipPolicy
    A SkipPolicy that depends on an exception classifier to make its decision, and then delegates to the classifier result.
    Author:
    Dave Syer
    See Also:
    SubclassClassifier
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      voidsetExceptionClassifier​(org.springframework.classify.SubclassClassifier<java.lang.Throwable,​SkipPolicy> classifier)
      The classifier that will be used to choose a delegate policy.
      voidsetPolicyMap​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​SkipPolicy> policyMap)
      Setter for policy map.
      booleanshouldSkip​(java.lang.Throwable t, int skipCount)
      Consult the classifier and find a delegate policy, and then use that to determine the outcome.
      • Methods inherited from class java.lang.Object

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

      • ExceptionClassifierSkipPolicy

        public ExceptionClassifierSkipPolicy()
    • Method Detail

      • setExceptionClassifier

        public void setExceptionClassifier​(org.springframework.classify.SubclassClassifier<java.lang.Throwable,​SkipPolicy> classifier)
        The classifier that will be used to choose a delegate policy.
        Parameters:
        classifier - the classifier to use to choose a delegate policy
      • setPolicyMap

        public void setPolicyMap​(java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​SkipPolicy> policyMap)
        Setter for policy map. This property should not be changed dynamically - set it once, e.g. in configuration, and then don't change it during a running application. Either this property or the exception classifier directly should be set, but not both.
        Parameters:
        policyMap - a map of String to SkipPolicy that will be used to create a Classifier to locate a policy.
      • shouldSkip

        public boolean shouldSkip​(java.lang.Throwable t,
                                  int skipCount)
                           throws SkipLimitExceededException
        Consult the classifier and find a delegate policy, and then use that to determine the outcome.
        Specified by:
        shouldSkip in interface SkipPolicy
        Parameters:
        t - the throwable to consider
        skipCount - the current skip count
        Returns:
        true if the exception can be skipped
        Throws:
        SkipLimitExceededException - if a limit is exceeded