Java Code Examples for org.springframework.cglib.proxy.MethodProxy#invoke()
The following examples show how to use
org.springframework.cglib.proxy.MethodProxy#invoke() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CglibAopProxy.java From spring-analysis-note with MIT License | 6 votes |
@Override @Nullable public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; Object target = this.targetSource.getTarget(); try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); if (target != null) { this.targetSource.releaseTarget(target); } } }
Example 2
Source File: CglibAopProxy.java From java-technology-stack with MIT License | 6 votes |
@Override @Nullable public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; Object target = this.targetSource.getTarget(); try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); if (target != null) { this.targetSource.releaseTarget(target); } } }
Example 3
Source File: EagleTraceCglibProxy.java From eagle with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object target = this.targetSource.getTarget(); try { Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { this.targetSource.releaseTarget(target); } }
Example 4
Source File: CglibAopProxy.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object target = this.targetSource.getTarget(); try { Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { this.targetSource.releaseTarget(target); } }
Example 5
Source File: CglibAopProxy.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); } }
Example 6
Source File: CglibAopProxy.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; Object target = this.targetSource.getTarget(); try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); this.targetSource.releaseTarget(target); } }
Example 7
Source File: CglibAopProxy.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object target = this.targetSource.getTarget(); try { Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { this.targetSource.releaseTarget(target); } }
Example 8
Source File: CglibAopProxy.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); } }
Example 9
Source File: EagleTraceCglibProxy.java From eagle with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Class<?> targetClass = null; Object target = null; try { // May be null. Get as late as possible to minimize the time we // "own" the target, in case it comes from a pool... target = getTarget(); if (target != null) { targetClass = target.getClass(); } Object retVal; if (EagleTraceMethodRecods.needTrace(method, targetClass)) { boolean clear = Strings.isNullOrEmpty(TraceContext.getTraceId()); try { if (clear) { TraceContext.setTraceId(OpaqueGenerator.getDistributeOpaque()); } retVal = methodProxy.invoke(target, args); } catch (Throwable e) { logger.error("Eagle trace error: ", e); throw new EagleFrameException(e); } finally { if (clear) { TraceContext.clear(); } } } else { retVal = methodProxy.invoke(target, args); } retVal = processReturnType(proxy, target, method, retVal); return retVal; } finally { if (target != null) { releaseTarget(target); } } }
Example 10
Source File: JedisCallback.java From spring-redis-plugin with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { Jedis jedis = null; filterMethod(method); try { jedis = jedisHolder.get(); return methodProxy.invoke(jedis, objects); } catch (Exception e) { LOGGER.error(e.getMessage()); throw e; } finally { release(jedis); } }
Example 11
Source File: ShardedJedisCallback.java From spring-redis-plugin with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable { ShardedJedis jedis; boolean status = jedisHolder.hasShardJedis(); if (!status) { throw new UnsupportedOperationException("ShardedJedis proxy need use @Redis annotation."); } try { jedis = jedisHolder.getShardedJedis(); return methodProxy.invoke(jedis, objects); } catch (Exception e) { LOGGER.error(e.getMessage()); throw e; } }
Example 12
Source File: CglibAopProxy.java From java-technology-stack with MIT License | 5 votes |
@Override @Nullable public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); } }
Example 13
Source File: CglibAopProxy.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; Object target = this.targetSource.getTarget(); try { oldProxy = AopContext.setCurrentProxy(proxy); Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { AopContext.setCurrentProxy(oldProxy); this.targetSource.releaseTarget(target); } }
Example 14
Source File: CglibAopProxy.java From spring-analysis-note with MIT License | 5 votes |
@Override @Nullable public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object target = this.targetSource.getTarget(); try { Object retVal = methodProxy.invoke(target, args); return processReturnType(proxy, target, method, retVal); } finally { if (target != null) { this.targetSource.releaseTarget(target); } } }
Example 15
Source File: CglibAopProxy.java From spring-analysis-note with MIT License | 4 votes |
@Override @Nullable public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); }
Example 16
Source File: CglibAopProxy.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); }
Example 17
Source File: CglibAopProxy.java From java-technology-stack with MIT License | 4 votes |
@Override @Nullable public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); }
Example 18
Source File: CglibAopProxy.java From lams with GNU General Public License v2.0 | 4 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; boolean setProxyContext = false; Class<?> targetClass = null; Object target = null; try { if (this.advised.exposeProxy) { // Make invocation available if necessary. oldProxy = AopContext.setCurrentProxy(proxy); setProxyContext = true; } // May be null. Get as late as possible to minimize the time we // "own" the target, in case it comes from a pool... target = getTarget(); if (target != null) { targetClass = target.getClass(); } List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass); Object retVal; // Check whether we only have one InvokerInterceptor: that is, // no real advice, but just reflective invocation of the target. if (chain.isEmpty() && Modifier.isPublic(method.getModifiers())) { // We can skip creating a MethodInvocation: just invoke the target directly. // Note that the final invoker must be an InvokerInterceptor, so we know // it does nothing but a reflective operation on the target, and no hot // swapping or fancy proxying. Object[] argsToUse = AopProxyUtils.adaptArgumentsIfNecessary(method, args); retVal = methodProxy.invoke(target, argsToUse); } else { // We need to create a method invocation... retVal = new CglibMethodInvocation(proxy, target, method, args, targetClass, chain, methodProxy).proceed(); } retVal = processReturnType(proxy, target, method, retVal); return retVal; } finally { if (target != null) { releaseTarget(target); } if (setProxyContext) { // Restore old proxy. AopContext.setCurrentProxy(oldProxy); } } }
Example 19
Source File: CglibAopProxy.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object retVal = methodProxy.invoke(this.target, args); return processReturnType(proxy, this.target, method, retVal); }
Example 20
Source File: CglibAopProxy.java From spring4-understanding with Apache License 2.0 | 4 votes |
@Override public Object intercept(Object proxy, Method method, Object[] args, MethodProxy methodProxy) throws Throwable { Object oldProxy = null; boolean setProxyContext = false; Class<?> targetClass = null; Object target = null; try { if (this.advised.exposeProxy) { // Make invocation available if necessary. oldProxy = AopContext.setCurrentProxy(proxy); setProxyContext = true; } // May be null. Get as late as possible to minimize the time we // "own" the target, in case it comes from a pool... target = getTarget(); if (target != null) { targetClass = target.getClass(); } List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass); Object retVal; // Check whether we only have one InvokerInterceptor: that is, // no real advice, but just reflective invocation of the target. if (chain.isEmpty() && Modifier.isPublic(method.getModifiers())) { // We can skip creating a MethodInvocation: just invoke the target directly. // Note that the final invoker must be an InvokerInterceptor, so we know // it does nothing but a reflective operation on the target, and no hot // swapping or fancy proxying. Object[] argsToUse = AopProxyUtils.adaptArgumentsIfNecessary(method, args); retVal = methodProxy.invoke(target, argsToUse); } else { // We need to create a method invocation... retVal = new CglibMethodInvocation(proxy, target, method, args, targetClass, chain, methodProxy).proceed(); } retVal = processReturnType(proxy, target, method, retVal); return retVal; } finally { if (target != null) { releaseTarget(target); } if (setProxyContext) { // Restore old proxy. AopContext.setCurrentProxy(oldProxy); } } }