public synchronized void consume(final long amount) {

    if (isBypass()) {
      return;
    }

    if (amount >= 0) {
      this.avail -= amount;
    } else {
      if (this.avail <= Long.MAX_VALUE + amount) {
        this.avail -= amount;
        this.avail = Math.min(this.avail, this.limit);
      } else {
        this.avail = this.limit;
      }
    }
  }
consume amount available units, amount could be a negative number
@param amount the number of units to consume
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/RateLimiter.java