@Singleton public class RecoveryInterceptor extends java.lang.Object implements MethodInterceptor<java.lang.Object,java.lang.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. |
HOTSWAP, LAZY, PROXY_TARGET
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
RecoveryInterceptor(BeanContext beanContext) |
Modifier and Type | Method and Description |
---|---|
java.util.Optional<? extends MethodExecutionHandle<?,java.lang.Object>> |
findFallbackMethod(MethodInvocationContext<java.lang.Object,java.lang.Object> context)
Finds a fallback method for the given context.
|
int |
getOrder() |
java.lang.Object |
intercept(MethodInvocationContext<java.lang.Object,java.lang.Object> context)
Extended version of the
MethodInterceptor.intercept(InvocationContext) method that accepts a MethodInvocationContext . |
protected java.lang.Object |
resolveFallback(MethodInvocationContext<java.lang.Object,java.lang.Object> context,
java.lang.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 java.lang.Object intercept(MethodInvocationContext<java.lang.Object,java.lang.Object> context)
MethodInterceptor
MethodInterceptor.intercept(InvocationContext)
method that accepts a MethodInvocationContext
.intercept
in interface MethodInterceptor<java.lang.Object,java.lang.Object>
context
- The contextpublic java.util.Optional<? extends MethodExecutionHandle<?,java.lang.Object>> findFallbackMethod(MethodInvocationContext<java.lang.Object,java.lang.Object> context)
context
- The contextprotected java.lang.Object resolveFallback(MethodInvocationContext<java.lang.Object,java.lang.Object> context, java.lang.RuntimeException exception)
context
- The contextexception
- The exception