@Singleton public class RecoveryInterceptor extends Object implements MethodInterceptor<Object,Object>
MethodInterceptor
that will attempt to execute a Fallback
when the target method is in an error state.Modifier and Type | Field and Description |
---|---|
static int |
POSITION
Positioned before the
Retryable interceptor. |
ARGUMENT, CACHEABLE_LAZY_TARGET, HOTSWAP, LAZY, PROXY_TARGET
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
RecoveryInterceptor(BeanContext beanContext) |
Modifier and Type | Method and Description |
---|---|
Optional<? extends MethodExecutionHandle<?,Object>> |
findFallbackMethod(MethodInvocationContext<Object,Object> context)
Finds a fallback method for the given context.
|
int |
getOrder() |
Object |
intercept(MethodInvocationContext<Object,Object> context)
Extended version of the
MethodInterceptor.intercept(InvocationContext) method that accepts a MethodInvocationContext . |
protected Object |
resolveFallback(MethodInvocationContext<Object,Object> context,
RuntimeException exception)
Resolves a fallback for the given execution context and exception.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
intercept
public static final int POSITION
Retryable
interceptor.public RecoveryInterceptor(BeanContext beanContext)
beanContext
- The bean context to allow for DI of class annotated with Inject
.public int getOrder()
public Object intercept(MethodInvocationContext<Object,Object> context)
MethodInterceptor
MethodInterceptor.intercept(InvocationContext)
method that accepts a MethodInvocationContext
.intercept
in interface MethodInterceptor<Object,Object>
context
- The contextpublic Optional<? extends MethodExecutionHandle<?,Object>> findFallbackMethod(MethodInvocationContext<Object,Object> context)
context
- The contextprotected Object resolveFallback(MethodInvocationContext<Object,Object> context, RuntimeException exception)
context
- The contextexception
- The exception