bbeaudreault commented on code in PR #5683:
URL: https://github.com/apache/hbase/pull/5683#discussion_r1491119880


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/quotas/RateLimiter.java:
##########
@@ -135,18 +135,32 @@ protected synchronized long getTimeUnitInMillis() {
 
   /**
    * Is there at least one resource available to allow execution?
-   * @return true if there is at least one resource available, otherwise false
+   * @return the waitInterval to backoff, or 0 if execution is allowed
    */
-  public boolean canExecute() {
+  public long canExecute() {
     return canExecute(1);
   }
 
+  /**
+   * Are there enough available resources to allow execution?
+   * @param amount the number of required resources, a non-negative number
+   * @return the waitInterval to backoff, or 0 if execution is allowed
+   */
+  public synchronized long canExecute(final long amount) {
+    assert amount >= 0;
+    long waitInterval = waitInterval(amount);

Review Comment:
   Also since it all happens within a synchronized method not, may not need to 
check both states below. Basically check is available first, return 0 if true, 
otherwise return getWaitInterval



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to