Dashboard > Public Content > ... > Spring > Using the ConcurrencyThrottleInterceptor
  Public Content Log In   View a printable version of the current page.  
  Using the ConcurrencyThrottleInterceptor
Added by James Richardson, last edited by James Richardson on Aug 02, 2006
Labels: 
(None)

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"/>
    </bean>

Then weaving an aspect

<bean class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator">
        <property name="beanNames">
            <value>SomeThing</value>
        </property>
        <property name="interceptorNames">
            <list>
                <value>global_concurrency</value>
            </list>
        </property>
    </bean>

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.

Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.1 Build:#806 May 06, 2007) - Bug/feature request - Contact Administrators