Using the Spring ConcurrencyThrottleInterceptor

The ConcurrencyThrottleInterceptor is a great bit of stuff to limit your use of heavy weight resources.

Use it simply by creating the bean:

<bean id="global_concurrency" class="org.springframework.aop.interceptor.ConcurrencyThrottleInterceptor" singleton="false">
      <property name="concurrencyLimit" value="5"/>

Then weaving an aspect

<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
        <property name="beanNames">
        <property name="interceptorNames">

However there is an important thing to note, which may-or-may not be completely obvious… the singleton must be set to false, otherwise you are saying that only a certain number of simultaneous invocations are allowed for all the beans you list, not just for each one individually.

comments powered by Disqus