public Object proceed() throws Exception { if (currentInterceptor < interceptorInfos.length) { int oldInterceptor = currentInterceptor; int oldMethod = currentMethod; try { int curr = currentInterceptor; int currMethod = currentMethod++; InterceptorInfo info = interceptorInfos[curr]; if (currMethod == info.getAroundInvokes().length) { curr = ++currentInterceptor; currentMethod = 0; currMethod = currentMethod++; info = (curr < interceptorInfos.length) ? interceptorInfos[curr] : null; } if (info != null) { try { return info.getAroundInvokes()[currMethod].invoke(instances[curr], this); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof Exception) { throw ((Exception) e.getCause()); } else { throw new RuntimeException(e.getCause()); } } } } finally { // so that interceptors like clustering can reinvoke down the chain currentInterceptor = oldInterceptor; currentMethod = oldMethod; } } if (beanAroundInvokes != null && currentBeanMethod < beanAroundInvokes.length) { try { int curr = currentBeanMethod++; return beanAroundInvokes[curr].invoke(getTarget(), this); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof Exception) { throw ((Exception) e.getCause()); } else { throw new RuntimeException(e.getCause()); } } finally { currentBeanMethod--; ; } } try { return wrapped.invokeNext(); } catch (Exception e) { throw e; } catch (Throwable t) { throw new RuntimeException(t); } }
public void setParameters(Object[] params) { wrapped.setArguments(params); }
public Method getMethod() { return wrapped.getMethod(); }
public Object[] getParameters() { return wrapped.getArguments(); }
public Object getTarget() { return wrapped.getTargetObject(); }