Example usage for org.springframework.aop.interceptor ConcurrencyThrottleInterceptor getConcurrencyLimit

List of usage examples for org.springframework.aop.interceptor ConcurrencyThrottleInterceptor getConcurrencyLimit

Introduction

In this page you can find the example usage for org.springframework.aop.interceptor ConcurrencyThrottleInterceptor getConcurrencyLimit.

Prototype

public int getConcurrencyLimit() 

Source Link

Document

Return the maximum number of concurrent access attempts allowed.

Usage

From source file:org.springframework.aop.interceptor.ConcurrencyThrottleInterceptorTests.java

@Test
public void testSerializable() throws Exception {
    DerivedTestBean tb = new DerivedTestBean();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setInterfaces(new Class[] { ITestBean.class });
    ConcurrencyThrottleInterceptor cti = new ConcurrencyThrottleInterceptor();
    proxyFactory.addAdvice(cti);//from  w  w w  .j a  v a2  s.  c  om
    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();
}