org.springframework.aop.interceptor
Class ConcurrencyThrottleInterceptor


public class ConcurrencyThrottleInterceptor
implements MethodInterceptor

Interceptor that throttles concurrent access, blocking invocations if a specified concurrency limit is reached.

Can be applied to methods of local services that involve heavy use of system resources, in a scenario where it is more efficient to throttle concurrency for a specific service rather than restricting the entire thread pool (e.g. the web container's thread pool).

Author:
Juergen Hoeller
Since: 11.02.2004

Method Summary
 Objectinvoke(MethodInvocation methodInvocation)
           
 voidsetConcurrencyLimit(int concurrencyLimit)
          Set the maximum number of parallel invocations that this interceptor allows.

Method Detail

invoke

public Object invoke(MethodInvocation methodInvocation)
throws java.lang.Throwable

setConcurrencyLimit

public void setConcurrencyLimit(int concurrencyLimit)
Set the maximum number of parallel invocations that this interceptor allows. Default is 1 (having the same effect as a synchronized block).