@Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { beforeAccess(); try { return methodInvocation.proceed(); } finally { afterAccess(); } }
public ConcurrencyThrottleInterceptor() { setConcurrencyLimit(1); }
ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.setInterfaces(ITestBean.class); ConcurrencyThrottleInterceptor cti = new ConcurrencyThrottleInterceptor(); cti.setConcurrencyLimit(concurrencyLimit); proxyFactory.addAdvice(cti); proxyFactory.setTarget(tb);
@Test public void testSerializable() throws Exception { DerivedTestBean tb = new DerivedTestBean(); ProxyFactory proxyFactory = new ProxyFactory(); proxyFactory.setInterfaces(ITestBean.class); ConcurrencyThrottleInterceptor cti = new ConcurrencyThrottleInterceptor(); proxyFactory.addAdvice(cti); proxyFactory.setTarget(tb); ITestBean proxy = (ITestBean) proxyFactory.getProxy(); proxy.getAge(); ITestBean serializedProxy = (ITestBean) SerializationTestUtils.serializeAndDeserialize(proxy); Advised advised = (Advised) serializedProxy; ConcurrencyThrottleInterceptor serializedCti = (ConcurrencyThrottleInterceptor) advised.getAdvisors()[0].getAdvice(); assertEquals(cti.getConcurrencyLimit(), serializedCti.getConcurrencyLimit()); serializedProxy.getAge(); }
public Object invoke(MethodInvocation methodInvocation) throws Throwable { beforeAccess(); try { return methodInvocation.proceed(); } finally { afterAccess(); } }
public ConcurrencyThrottleInterceptor() { setConcurrencyLimit(1); }
@Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { beforeAccess(); try { return methodInvocation.proceed(); } finally { afterAccess(); } }
public ConcurrencyThrottleInterceptor() { setConcurrencyLimit(1); }
@Override public Object invoke(MethodInvocation methodInvocation) throws Throwable { beforeAccess(); try { return methodInvocation.proceed(); } finally { afterAccess(); } }