Class ConcurrencyThrottleInterceptor
java.lang.Object
org.springframework.util.ConcurrencyThrottleSupport
org.springframework.aop.interceptor.ConcurrencyThrottleInterceptor
- All Implemented Interfaces:
- Serializable, Advice, Interceptor, MethodInterceptor
public class ConcurrencyThrottleInterceptor
extends ConcurrencyThrottleSupport
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 restrict the entire thread pool (for example, the web container's thread pool).
The default concurrency limit of this interceptor is 1. Specify the "concurrencyLimit" bean property to change this value.
- Since:
- 11.02.2004
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFields inherited from class ConcurrencyThrottleSupportlogger, NO_CONCURRENCY, UNBOUNDED_CONCURRENCY
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a defaultConcurrencyThrottleInterceptorwith concurrency limit 1.ConcurrencyThrottleInterceptor(int concurrencyLimit) Create aConcurrencyThrottleInterceptorwith the given concurrency limit.
- 
Method SummaryModifier and TypeMethodDescriptioninvoke(MethodInvocation methodInvocation) Implement this method to perform extra treatments before and after the invocation.Methods inherited from class ConcurrencyThrottleSupportafterAccess, beforeAccess, getConcurrencyLimit, isThrottleActive, onLimitReached, setConcurrencyLimit
- 
Constructor Details- 
ConcurrencyThrottleInterceptorpublic ConcurrencyThrottleInterceptor()Create a defaultConcurrencyThrottleInterceptorwith concurrency limit 1.
- 
ConcurrencyThrottleInterceptorpublic ConcurrencyThrottleInterceptor(int concurrencyLimit) Create aConcurrencyThrottleInterceptorwith the given concurrency limit.- Since:
- 7.0
 
 
- 
- 
Method Details- 
invokeDescription copied from interface:MethodInterceptorImplement this method to perform extra treatments before and after the invocation. Polite implementations would certainly like to invokeJoinpoint.proceed().- Specified by:
- invokein interface- MethodInterceptor
- Parameters:
- methodInvocation- the method invocation joinpoint
- Returns:
- the result of the call to Joinpoint.proceed(); might be intercepted by the interceptor
- Throws:
- Throwable- if the interceptors or the target object throws an exception
 
 
-