org.springframework.aop.interceptor
Class ConcurrencyThrottleInterceptor

java.lang.Object
  extended byorg.springframework.aop.interceptor.ConcurrencyThrottleInterceptor
All Implemented Interfaces:
Advice, Interceptor, MethodInterceptor, Serializable

public class ConcurrencyThrottleInterceptor
extends Object
implements MethodInterceptor, Serializable

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).

Since:
11.02.2004
Author:
Juergen Hoeller
See Also:
Serialized Form

Field Summary
protected static Log logger
          Static to avoid serializing the logger
 
Constructor Summary
ConcurrencyThrottleInterceptor()
           
 
Method Summary
 Object invoke(MethodInvocation methodInvocation)
           
 void setConcurrencyLimit(int concurrencyLimit)
          Set the maximum number of parallel invocations that this interceptor allows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Log logger
Static to avoid serializing the logger

Constructor Detail

ConcurrencyThrottleInterceptor

public ConcurrencyThrottleInterceptor()
Method Detail

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).


invoke

public Object invoke(MethodInvocation methodInvocation)
              throws Throwable
Specified by:
invoke in interface MethodInterceptor
Throws:
Throwable


Copyright (C) 2003-2004 The Spring Framework Project.