public synchronized void consume(final long amount) {
    if (amount >= 0) {
      this.avail -= amount;
      if (this.avail < 0) {
        this.avail = 0;
      }
    } 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
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/quotas/RateLimiter.java