From 8ea9bbce2614e8eb499af73589f021ed1789e78f Mon Sep 17 00:00:00 2001 From: Masatake Iwasaki Date: Thu, 9 Jun 2016 14:52:29 +0900 Subject: [PATCH] HDFS-10508. DFSInputStream should set thread's interrupt status after catching InterruptException from sleep. Contributed by Jing Zhao. --- .../src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java index 7f32a56c38e..6132f83efec 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java @@ -306,6 +306,7 @@ public class DFSInputStream extends FSInputStream try { Thread.sleep(waitTime); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new InterruptedIOException( "Interrupted while getting the last block length."); } @@ -417,6 +418,7 @@ public class DFSInputStream extends FSInputStream try { Thread.sleep(500); // delay between retries. } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new InterruptedIOException( "Interrupted while getting the length."); } @@ -1063,6 +1065,7 @@ public class DFSInputStream extends FSInputStream " IOException, will wait for " + waitTime + " msec."); Thread.sleep((long)waitTime); } catch (InterruptedException e) { + Thread.currentThread().interrupt(); throw new InterruptedIOException( "Interrupted while choosing DataNode for read."); }