You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "ChiaPing Tsai (JIRA)" <ji...@apache.org> on 2016/12/17 12:34:58 UTC

[jira] [Created] (HBASE-17331) Avoid busy waiting in ThrottledInputStream

ChiaPing Tsai created HBASE-17331:
-------------------------------------

             Summary: Avoid busy waiting in ThrottledInputStream
                 Key: HBASE-17331
                 URL: https://issues.apache.org/jira/browse/HBASE-17331
             Project: HBase
          Issue Type: Improvement
            Reporter: ChiaPing Tsai
            Priority: Minor


{code:title=ThrottledInputStream.java|borderStyle=solid}
// We can calculate the precise sleep time instead of busy waiting
  private void throttle() throws IOException {
    while (getBytesPerSec() > maxBytesPerSec) {
      try {
        Thread.sleep(SLEEP_DURATION_MS);
        totalSleepTime += SLEEP_DURATION_MS;
      } catch (InterruptedException e) {
        throw new IOException("Thread aborted", e);
      }
    }
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)