anoopsjohn commented on a change in pull request #1765:
URL: https://github.com/apache/hbase/pull/1765#discussion_r429538933



##########
File path: 
hbase-common/src/main/java/org/apache/hadoop/hbase/io/hadoopbackport/ThrottledInputStream.java
##########
@@ -143,14 +144,10 @@ static long calSleepTimeMs(long bytesRead, long 
maxBytesPerSec, long elapsed) {
     }
   }
 
-  private void throttle() throws InterruptedIOException {
+  private void throttle() {
     long sleepTime = calSleepTimeMs();
     totalSleepTime += sleepTime;
-    try {
-      TimeUnit.MILLISECONDS.sleep(sleepTime);
-    } catch (InterruptedException e) {
-      throw new InterruptedIOException("Thread aborted");
-    }
+    Uninterruptibles.sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);

Review comment:
       Do we need to this jira? When during the throttle sleep, if we interrupt 
this thread, it would have come out of sleep by throwing an IOE as per the 
current code.  But a call to sleepUninterruptibly will make sure the thread is 
in sleep state for that much time.  The interrupt might be for a genuine case 
to stop the running thread.  Now this change will make it such that even if 
been interrupted, the thread will still continue to be executed!

##########
File path: 
hbase-it/src/test/java/org/apache/hadoop/hbase/RESTApiClusterManager.java
##########
@@ -513,11 +513,7 @@ private boolean hasCommandCompletedSuccessfully(final long 
commandId) {
           throw new RuntimeException("retries exhausted", e);
         }
       }
-      try {
-        retryCounter.sleepUntilNextRetry();
-      } catch (InterruptedException e) {
-        throw new RuntimeException(e);
-      }
+      retryCounter.sleepUntilNextRetry();

Review comment:
       Here also we are changing the behave. Previously throw RTE when 
interrupted. But now this is been changed  Main thing is even if interrupted, 
the RetryCounter will make sure the thread been slept for the specified time 
(Which might not be really wanted some times)




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to