public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { return invoker.invoke(proxy, method, args); } }
@SuppressWarnings({ "unchecked" }) private <T> T createHDCEnabledJaxrsClientInterceptorProxy(final T cxfProxy, final Class<T> restServiceApiClass) { return (T) new ProxyFactory().createInterceptorProxy(cxfProxy, new Interceptor() { @Override public Object intercept(Invocation invocation) throws Throwable { Task jaxrsClientTask = null; try { if (HDC.isStarted()) { jaxrsClientTask = HDC.getCurrentTask().startSubtask("RestProxyServicePlugin"); jaxrsClientTask.setAttribute("class", restServiceApiClass.getName()); jaxrsClientTask.setAttribute("method", invocation.getMethod().getName()); } return invocation.proceed(); } finally { if (jaxrsClientTask != null) { jaxrsClientTask.stop(); } } } }, new Class [] { restServiceApiClass }); } }
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(delegateProvider.getObject(), args); } catch (InvocationTargetException e) { throw e.getTargetException(); } } }
String methodName = invocation.getMethod().getName(); this.passivated = true; } else if ("logoutSession".equals(methodName)) { Session session = (Session) invocation.getProxy(); ret = userID; } else { ret = invocation.proceed(); ret = super.toString() + " (" + invocation.proceed().toString() + ")"; } else if ("hashCode".equals(methodName)) { ret = invocation.proceed(); } else { if (this.passivated) { if ("isLive".equals(methodName)) { if (poolingRepository.isActive()) { ret = invocation.proceed(); } else { ret = Boolean.FALSE; Session session = (Session) invocation.getProxy(); ret = invocation.proceed(); lastRefreshed = System.currentTimeMillis(); } else if ("localRefresh".equals(methodName)) { Session session = (Session) invocation.getProxy(); if (session instanceof HippoSession) {
public Object intercept(Invocation invocation) throws Throwable { Method method = invocation.getMethod(); String methodName = method.getName(); Object[] args = invocation.getArguments(); if ("getResourcePaths".equals(methodName) && args.length > 0 && ("/WEB-INF/lib".equals(args[0]) || "/WEB-INF/lib/".equals(args[0]))) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader instanceof URLClassLoader) { URL[] urls = ((URLClassLoader) loader).getURLs(); if (urls != null) { Set<String> paths = new HashSet<>(); for (int i = 0; i < urls.length; i++) { String url = urls[i].toString(); paths.add(url); } return paths; } } } else if ("getResourceAsStream".equals(methodName) && args.length > 0 && args[0].toString().startsWith("file:")) { URL url = new URL((String) args[0]); return url.openStream(); } else if ("getResource".equals(methodName) && args.length > 0 && args[0].toString().startsWith("file:")) { URL url = new URL((String) args[0]); return url; } return invocation.proceed(); } };
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { final ReflectionInvocation invocation = new ReflectionInvocation(target, method, args); return methodInterceptor.intercept(invocation); } }
public static <T> T monitor(final Class<T> clazz, final Object instance) { return clazz.cast( IoCs.findOrCreateInstance(ProxyFactory.class) .createInvokerProxy(ClassLoaders.current(), new SironaPerformanceHandler(instance), new Class<?>[]{clazz})); }
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { return invoker.invoke(proxy, method, args); } }
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { final ReflectionInvocation invocation = new ReflectionInvocation(target, method, args); return methodInterceptor.intercept(invocation); } }
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(delegateProvider.getObject(), args); } catch (InvocationTargetException e) { throw e.getTargetException(); } } }
/** * Stubs a type for creating a lambda. The resulting stub * <strong>must</strong> receive one and only one message. * * Not all {@link LambdaFactory}s can stub all types - ie, stubbing * interfaces, concrete classes or final classes. Their stubbing capabilities * depend on the {@link ProxyFactory} passed as constructor argument to this * {@link LambdaFactory} * * @param <A> * @param clazz * the type to stub * @return a new stub */ @EnforceRestrictions @NonNull public <A> A $(@NonNull Class<A> clazz) { STATE.that(!firstStep, "Wrong invocation order"); A stub = (A) proxyFactory.createInvokerProxy(handler, new Class[] { clazz }); firstStep = true; return stub; }
@Override public Object intercept(Invocation invocation) throws Throwable { Task jaxrsClientTask = null; try { if (HDC.isStarted()) { jaxrsClientTask = HDC.getCurrentTask().startSubtask("RestProxyServicePlugin"); jaxrsClientTask.setAttribute("class", restServiceApiClass.getName()); jaxrsClientTask.setAttribute("method", invocation.getMethod().getName()); } return invocation.proceed(); } finally { if (jaxrsClientTask != null) { jaxrsClientTask.stop(); } } } }, new Class [] { restServiceApiClass });
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { return invoker.invoke(proxy, method, args); } }
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { final ReflectionInvocation invocation = new ReflectionInvocation(target, method, args); return methodInterceptor.intercept(invocation); } }
public Object invokeImpl(Object proxy, Method method, Object[] args) throws Throwable { try { return method.invoke(delegateProvider.getObject(), args); } catch (InvocationTargetException e) { throw e.getTargetException(); } } }