*
* If the InvocationContext used is our InterceptorInvocationContext or if there is no more than 1 InterceptorMethodInvocation
* then no special treatment is required. Otherwise, we use a wrapper InvocationTarget for the purpose of executing the chain of
* interceptor methods of this interceptor.
*/
final InterceptionChain chain = new SimpleInterceptionChain(invocation) {
@Override
protected Object interceptorChainCompleted(InvocationContext context) throws Exception {
return ctx.proceed(); // done with the inner chain, let the outer chain proceed
}
};
return chain.invokeNextInterceptor(new ForwardingInvocationContext() {
@Override
protected InvocationContext delegate() {
return ctx;
}
@Override
public Object proceed() throws Exception {
return chain.invokeNextInterceptor(this);
}
});
}
} catch (RuntimeException e) {
throw e;