Class AbstractTransientExceptionPredicate

  • All Implemented Interfaces:
    java.util.function.Predicate<java.lang.Throwable>
    Direct Known Subclasses:
    JMXUtils.JmxConnectionErrorPredicate, TransientTransportErrorPredicate

    public abstract class AbstractTransientExceptionPredicate
    extends java.lang.Object
    implements java.util.function.Predicate<java.lang.Throwable>
    Base class for Attivio predicates checking to see if an exception can be recovered from by choosing another provider and/or waiting for one to come online.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Throwable checkTransientPredicates​(java.util.List<java.lang.Class<? extends java.util.function.Predicate<java.lang.Throwable>>> predicates, java.lang.reflect.InvocationTargetException ite)
      Returns the unwrapped exception if it passed a predicate, throws the unwrapped exception otherwise.
      protected boolean isPresent​(java.lang.Throwable t, ErrorCode ec)
      Recursively walks the exception and its causes, returning true if any of them are AttivioExceptions and contain the specified error code ec.
      protected boolean isPresent​(java.lang.Throwable t, java.lang.Class<?> wanted)
      Recursively walks the exception and its causes, returning true if any of them are match the class specified by wanted .
      protected abstract boolean isTransient​(java.lang.Throwable t)  
      boolean test​(java.lang.Throwable t)
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.function.Predicate

        and, negate, or
    • Constructor Detail

      • AbstractTransientExceptionPredicate

        public AbstractTransientExceptionPredicate()
    • Method Detail

      • isTransient

        protected abstract boolean isTransient​(java.lang.Throwable t)
        Parameters:
        t -
        Returns:
        true if the another try should be done with a different service provider
      • test

        public boolean test​(java.lang.Throwable t)
        Specified by:
        test in interface java.util.function.Predicate<java.lang.Throwable>
      • isPresent

        protected boolean isPresent​(java.lang.Throwable t,
                                    ErrorCode ec)
        Recursively walks the exception and its causes, returning true if any of them are AttivioExceptions and contain the specified error code ec.
        Parameters:
        t -
        ec -
        Returns:
      • isPresent

        protected boolean isPresent​(java.lang.Throwable t,
                                    java.lang.Class<?> wanted)
        Recursively walks the exception and its causes, returning true if any of them are match the class specified by wanted .
        Parameters:
        t -
        wanted -
        Returns:
      • checkTransientPredicates

        public static java.lang.Throwable checkTransientPredicates​(java.util.List<java.lang.Class<? extends java.util.function.Predicate<java.lang.Throwable>>> predicates,
                                                                   java.lang.reflect.InvocationTargetException ite)
                                                            throws java.lang.Throwable
        Returns the unwrapped exception if it passed a predicate, throws the unwrapped exception otherwise.
        Parameters:
        predicates -
        ite -
        Throws:
        java.lang.Throwable