Java Tutorial/Spring/Interceptor
Concurrency Throttle Interceptor
File: context.xml
<source lang="java">
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="afterBean" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="target"> <bean class="MtBean"> <property name="firstName" value="AAA"/> </bean> </property> <property name="interceptorNames"> <list> <idref bean="endMatchPointcutAdvisor"/> </list> </property> <property name="proxyTargetClass" value="true"/> </bean> <bean id="endMatchPointcutAdvisor" class="org.springframework.aop.support.NameMatchMethodPointcutAdvisor" singleton="false"> <property name="advice" ref="concurrencyThrottleInterceptor"/> <property name="mappedName" value="showValues"/> </bean> <bean id="concurrencyThrottleInterceptor" class="org.springframework.aop.interceptor.ConcurrencyThrottleInterceptor" singleton="false"> <property name="concurrencyLimit" value="5"/> </bean>
</beans></source>