public class DefaultExceptionPolicyStrategy extends Object implements ExceptionPolicyStrategy
ExceptionPolicyKey
that should handle the thrown exception.
Selection strategy: createExceptionIterable(Throwable)
provides the Iterator used for the walking.filter(ExceptionPolicyKey, Class, Throwable)
method. By default the filter uses
instanceof test.ExceptionPolicyKey
has a when defined with an expression the type is also matches against the current
exchange using the matchesWhen(ExceptionPolicyKey, org.apache.camel.Exchange)
method. This can be used to
for more fine grained matching, so you can e.g. define multiple sets of exception types with the same exception
class(es) but have a predicate attached to select which to select at runtime.Modifier and Type | Field and Description |
---|---|
static DefaultExceptionPolicyStrategy |
INSTANCE |
Constructor and Description |
---|
DefaultExceptionPolicyStrategy() |
Modifier and Type | Method and Description |
---|---|
protected Iterable<Throwable> |
createExceptionIterable(Throwable exception)
Strategy method creating the iterator to walk the exception in the order Camel should use for find the
ExceptionPolicyKey should be used. |
protected boolean |
filter(ExceptionPolicyKey type,
Class<?> exceptionClass,
Throwable exception)
Strategy to filter the given type exception class with the thrown exception
|
ExceptionPolicyKey |
getExceptionPolicy(Set<ExceptionPolicyKey> exceptionPolicies,
org.apache.camel.Exchange exchange,
Throwable exception)
Resolves the
ExceptionPolicyKey that should handle the thrown exception. |
protected boolean |
matchesWhen(ExceptionPolicyKey definition,
org.apache.camel.Exchange exchange)
Strategy method for matching the exception type with the current exchange.
|
public static final DefaultExceptionPolicyStrategy INSTANCE
public ExceptionPolicyKey getExceptionPolicy(Set<ExceptionPolicyKey> exceptionPolicies, org.apache.camel.Exchange exchange, Throwable exception)
ExceptionPolicyStrategy
ExceptionPolicyKey
that should handle the thrown exception.getExceptionPolicy
in interface ExceptionPolicyStrategy
exceptionPolicies
- the configured exception policies to resolve fromexchange
- the exchangeexception
- the exception that was thrownprotected boolean filter(ExceptionPolicyKey type, Class<?> exceptionClass, Throwable exception)
type
- the exception typeexceptionClass
- the current exception class for testingexception
- the thrown exceptionprotected boolean matchesWhen(ExceptionPolicyKey definition, org.apache.camel.Exchange exchange)
definition
- the exception definitionexchange
- the current Exchange
protected Iterable<Throwable> createExceptionIterable(Throwable exception)
ExceptionPolicyKey
should be used.
The default iterator will walk from the bottom upwards (the last caused by going upwards to the exception)exception
- the exceptionApache Camel