类 CurrentConcurrencyManager
java.lang.Object
com.alibaba.csp.sentinel.cluster.flow.statistic.concurrent.CurrentConcurrencyManager
We use a ConcurrentHashMap<long, AtomicInteger> type structure to store nowCalls corresponding to
rules, where the key is flowId and the value is nowCalls. Because nowCalls may be accessed and
modified by multiple threads, we consider to design it as an AtomicInteger class . Each newly
created rule will add a nowCalls object to this map. If the concurrency corresponding to a rule changes,
we will update the corresponding nowCalls in real time. Each request to obtain a token will increase the nowCalls;
and the request to release the token will reduce the nowCalls.
- 作者:
- yunfeiyanggzq
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidaddConcurrency(Long flowId, Integer acquireCount) add current concurrency.static booleancontainsFlowId(Long flowId) check flow id.static AtomicIntegerget the current concurrency.get NOW_CALLS_MAP.static voidput the current concurrency.static voiddelete the current concurrency.
-
构造器详细资料
-
CurrentConcurrencyManager
public CurrentConcurrencyManager()
-
-
方法详细资料
-
addConcurrency
add current concurrency. -
get
get the current concurrency. -
remove
delete the current concurrency. -
put
put the current concurrency. -
containsFlowId
check flow id. -
getConcurrencyMapKeySet
get NOW_CALLS_MAP.
-