java.lang.Object
com.alibaba.nacos.plugin.control.tps.barrier.RateCounter
直接已知子类:
LocalSimpleCountRateCounter

public abstract class RateCounter extends Object
abstract rate counter.
作者:
zunfei.lzf
  • 字段详细资料

    • name

      private String name
      rate count name.
    • period

      private TimeUnit period
      rate period.
  • 构造器详细资料

  • 方法详细资料

    • getPeriod

      public TimeUnit getPeriod()
    • add

      public abstract long add(long timestamp, long count)
      add count for the second of timestamp.
      参数:
      timestamp - timestamp.
      count - count.
      返回:
    • tryAdd

      public abstract boolean tryAdd(long timestamp, long countDelta, long upperLimit)
      add intercepted count for the second of timestamp.
      参数:
      timestamp - timestamp
      countDelta - count
      upperLimit - upperLimit
      返回:
    • getCount

      public abstract long getCount(long timestamp)
      get count of the second of timestamp.
      参数:
      timestamp - timestamp.
      返回:
    • getName

      public String getName()
    • getTrimMillsOfMinute

      public static long getTrimMillsOfMinute(long timeStamp)
      get trim mills of second.
      参数:
      timeStamp - timestamp milliseconds.
      返回:
    • getTrimMillsOfSecond

      public static long getTrimMillsOfSecond(long timeStamp)
      get trim mills of second.
      参数:
      timeStamp - timestamp milliseconds.
      返回:
    • getTrimMillsOfHour

      public static long getTrimMillsOfHour(long timeStamp)
      get trim mills of second.
      参数:
      timeStamp - timestamp milliseconds.
      返回: