Package com.attivio.service
Class AbstractTransientExceptionPredicate
- java.lang.Object
-
- com.attivio.service.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.
-
-
Constructor Summary
Constructors Constructor Description AbstractTransientExceptionPredicate()
-
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 codeec
.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 bywanted
.protected abstract boolean
isTransient(java.lang.Throwable t)
boolean
test(java.lang.Throwable t)
-
-
-
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 interfacejava.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 codeec
.- 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 bywanted
.- 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
-
-