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.
setConcurrencyLimit, beforeAccess(), afterAccess(), org.springframework.aop.interceptor.ConcurrencyThrottleInterceptor , java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
| private final Condition | |
| private int | |
| private int | |
| private final Lock | |
| protected transient Log | logger
Transient to optimize serialization. |
| public static final int | NO_CONCURRENCY
Switch concurrency 'off': that is, don't allow any concurrent invocations. |
| public static final int | UNBOUNDED_CONCURRENCY
Permit any number of concurrent invocations: that is, don't throttle concurrency. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| protected void | |
| public int | |
| public boolean | Returns: true if the concurrency limit for this instance is activeReturn whether this throttle is currently active. |
| private void | |
| public void | setConcurrencyLimit(int concurrencyLimit)
Set the maximum number of concurrent access attempts allowed. |
| concurrencyCondition | back to summary |
|---|---|
| private final Condition concurrencyCondition | |
| concurrencyCount | back to summary |
|---|---|
| private int concurrencyCount | |
| concurrencyLimit | back to summary |
|---|---|
| private int concurrencyLimit | |
| concurrencyLock | back to summary |
|---|---|
| private final Lock concurrencyLock | |
| logger | back to summary |
|---|---|
| protected transient Log logger Transient to optimize serialization. | |
| NO_CONCURRENCY | back to summary |
|---|---|
| public static final int NO_CONCURRENCY Switch concurrency 'off': that is, don't allow any concurrent invocations. | |
| UNBOUNDED_CONCURRENCY | back to summary |
|---|---|
| public static final int UNBOUNDED_CONCURRENCY Permit any number of concurrent invocations: that is, don't throttle concurrency. | |
| ConcurrencyThrottleSupport | back to summary |
|---|---|
| public ConcurrencyThrottleSupport() | |
| afterAccess | back to summary |
|---|---|
| protected void afterAccess() To be invoked after the main execution logic of concrete subclasses.
| |
| beforeAccess | back to summary |
|---|---|
| protected void beforeAccess() To be invoked before the main execution logic of concrete subclasses. This implementation applies the concurrency throttle.
| |
| getConcurrencyLimit | back to summary |
|---|---|
| public int getConcurrencyLimit() Return the maximum number of concurrent access attempts allowed. | |
| isThrottleActive | back to summary |
|---|---|
| public boolean isThrottleActive() Return whether this throttle is currently active.
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException | |
| setConcurrencyLimit | back to summary |
|---|---|
| public void setConcurrencyLimit(int concurrencyLimit) Set the maximum number of concurrent access attempts allowed. The default of -1 indicates no concurrency limit at all. 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. | |