protected boolean isAvailable(final long amount) {
    if (isBypass()) {
      return true;
    }

    long refillAmount = refill(limit);
    if (refillAmount == 0 && avail < amount) {
      return false;
    }
    // check for positive overflow
    if (avail <= Long.MAX_VALUE - refillAmount) {
      avail = Math.min(avail + refillAmount, limit);
    } else {
      avail = limit;
    }
    if (avail >= amount) {
      return true;
    }
    return false;
  }
Are there enough available resources to allow execution?
@param amount the number of required resources, a non-negative number
@return true if there are enough available resources, otherwise false
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/RateLimiter.java