类 CurrentConcurrencyManager

java.lang.Object
com.alibaba.csp.sentinel.cluster.flow.statistic.concurrent.CurrentConcurrencyManager

public final class CurrentConcurrencyManager extends Object
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
  • 构造器详细资料

    • CurrentConcurrencyManager

      public CurrentConcurrencyManager()
  • 方法详细资料

    • addConcurrency

      public static void addConcurrency(Long flowId, Integer acquireCount)
      add current concurrency.
    • get

      public static AtomicInteger get(Long flowId)
      get the current concurrency.
    • remove

      public static void remove(Long flowId)
      delete the current concurrency.
    • put

      public static void put(Long flowId, Integer nowCalls)
      put the current concurrency.
    • containsFlowId

      public static boolean containsFlowId(Long flowId)
      check flow id.
    • getConcurrencyMapKeySet

      public static Set<Long> getConcurrencyMapKeySet()
      get NOW_CALLS_MAP.