接口 OccupySupport

所有已知子接口:
Node
所有已知实现类:
ClusterNode, DefaultNode, EntranceNode, StatisticNode

public interface OccupySupport
从以下版本开始:
1.5.0
作者:
Eric Zhao
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    addOccupiedPass(int acquireCount)
    Add occupied pass request, which represents pass requests that borrow the latter windows' token.
    void
    addWaitingRequest(long futureTime, int acquireCount)
    Add request that occupied.
    double
    Get current occupied pass QPS.
    long
    tryOccupyNext(long currentTime, int acquireCount, double threshold)
    Try to occupy latter time windows' tokens.
    long
    Get current waiting amount.
  • 方法详细资料

    • tryOccupyNext

      long tryOccupyNext(long currentTime, int acquireCount, double threshold)
      Try to occupy latter time windows' tokens. If occupy success, a value less than occupyTimeout in OccupyTimeoutProperty will be return.

      Each time we occupy tokens of the future window, current thread should sleep for the corresponding time for smoothing QPS. We can't occupy tokens of the future with unlimited, the sleep time limit is occupyTimeout in OccupyTimeoutProperty.

      参数:
      currentTime - current time millis.
      acquireCount - tokens count to acquire.
      threshold - qps threshold.
      返回:
      time should sleep. Time >= occupyTimeout in OccupyTimeoutProperty means occupy fail, in this case, the request should be rejected immediately.
    • waiting

      long waiting()
      Get current waiting amount. Useful for debug.
      返回:
      current waiting amount
    • addWaitingRequest

      void addWaitingRequest(long futureTime, int acquireCount)
      Add request that occupied.
      参数:
      futureTime - future timestamp that the acquireCount should be added on.
      acquireCount - tokens count.
    • addOccupiedPass

      void addOccupiedPass(int acquireCount)
      Add occupied pass request, which represents pass requests that borrow the latter windows' token.
      参数:
      acquireCount - tokens count.
    • occupiedPassQps

      double occupiedPassQps()
      Get current occupied pass QPS.
      返回:
      current occupied pass QPS