类 ConcurrencyThrottleSupport
- 所有已实现的接口:
Serializable
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.
- 从以下版本开始:
- 4.0 2021/9/11 15:45
- 作者:
- Juergen Hoeller, Harry Yang
- 另请参阅:
-
setConcurrencyLimit(int)beforeAccess()afterAccess()cn.taketoday.aop.interceptor.ConcurrencyThrottleInterceptorSerializable- 序列化表格
-
字段概要
字段修饰符和类型字段说明private final Conditionprivate intprivate intprivate final Lockprotected LoggerTransient 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. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected 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.private voidvoidsetConcurrencyLimit(int concurrencyLimit) Set the maximum number of concurrent access attempts allowed
-
字段详细资料
-
UNBOUNDED_CONCURRENCY
public static final int UNBOUNDED_CONCURRENCYPermit any number of concurrent invocations: that is, don't throttle concurrency.- 另请参阅:
-
NO_CONCURRENCY
public static final int NO_CONCURRENCYSwitch concurrency 'off': that is, don't allow any concurrent invocations.- 另请参阅:
-
logger
Transient to optimize serialization. -
concurrencyLock
-
concurrencyCondition
-
concurrencyLimit
private int concurrencyLimit -
concurrencyCount
private int concurrencyCount
-
-
构造器详细资料
-
ConcurrencyThrottleSupport
public ConcurrencyThrottleSupport()
-
-
方法详细资料
-
setConcurrencyLimit
public 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.
-
getConcurrencyLimit
public int getConcurrencyLimit()Return the maximum number of concurrent access attempts allowed. -
isThrottleActive
public boolean isThrottleActive()Return whether this throttle is currently active.- 返回:
trueif the concurrency limit for this instance is active- 另请参阅:
-
beforeAccess
protected void beforeAccess()To be invoked before the main execution logic of concrete subclasses.This implementation applies the concurrency throttle.
- 另请参阅:
-
afterAccess
protected void afterAccess()To be invoked after the main execution logic of concrete subclasses.- 另请参阅:
-
readObject
-