Class ConcurrencyThrottleSupport
- All Implemented Interfaces:
- Serializable
- Direct Known Subclasses:
- ConcurrencyThrottleInterceptor
Designed for use as a base class, with the subclass invoking
 the beforeAccess() and afterAccess() methods at
 appropriate points of its workflow. Note that afterAccess
 should usually be called in a finally block!
 
The default concurrency limit of this support class is -1 ("unbounded concurrency"). Subclasses may override this default; check the javadoc of the concrete class that you're using.
- Since:
- 1.2.5
- Author:
- Juergen Hoeller
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected LogTransient to optimize serialization.static final intSwitch concurrency 'off': that is, don't allow any concurrent invocations.static final intPermit any number of concurrent invocations: that is, don't throttle concurrency.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidTo be invoked after the main execution logic of concrete subclasses.protected voidTo be invoked before the main execution logic of concrete subclasses.intReturn the maximum number of concurrent access attempts allowed.booleanReturn whether this throttle is currently active.voidsetConcurrencyLimit(int concurrencyLimit) Set the maximum number of concurrent access attempts allowed.
- 
Field Details- 
UNBOUNDED_CONCURRENCYpublic static final int UNBOUNDED_CONCURRENCYPermit any number of concurrent invocations: that is, don't throttle concurrency.- See Also:
 
- 
NO_CONCURRENCYpublic static final int NO_CONCURRENCYSwitch concurrency 'off': that is, don't allow any concurrent invocations.- See Also:
 
- 
loggerTransient to optimize serialization.
 
- 
- 
Constructor Details- 
ConcurrencyThrottleSupportpublic ConcurrencyThrottleSupport()
 
- 
- 
Method Details- 
setConcurrencyLimitpublic void setConcurrencyLimit(int concurrencyLimit) Set the maximum number of concurrent access attempts allowed. -1 indicates unbounded concurrency.In principle, this limit can be changed at runtime, although it is generally designed as a config time setting. NOTE: Do not switch between -1 and any concrete limit at runtime, as this will lead to inconsistent concurrency counts: A limit of -1 effectively turns off concurrency counting completely. 
- 
getConcurrencyLimitpublic int getConcurrencyLimit()Return the maximum number of concurrent access attempts allowed.
- 
isThrottleActivepublic boolean isThrottleActive()Return whether this throttle is currently active.- Returns:
- trueif the concurrency limit for this instance is active
- See Also:
 
- 
beforeAccessprotected void beforeAccess()To be invoked before the main execution logic of concrete subclasses.This implementation applies the concurrency throttle. - See Also:
 
- 
afterAccessprotected void afterAccess()To be invoked after the main execution logic of concrete subclasses.- See Also:
 
 
-