diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 00781b1a65d..52b5f613623 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -156,6 +156,9 @@ Release 2.0.1-alpha - UNRELEASED HDFS-3266. DFSTestUtil#waitCorruptReplicas doesn't sleep between checks. (Madhukara Phatak via atm) + HDFS-3505. DirectoryScanner does not join all threads in shutdown. + (Colin Patrick McCabe via eli) + Release 2.0.0-alpha - 05-23-2012 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java index eac68d970b9..3a143357ac8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DirectoryScanner.java @@ -302,6 +302,22 @@ public class DirectoryScanner implements Runnable { shouldRun = false; if (masterThread != null) masterThread.shutdown(); if (reportCompileThreadPool != null) reportCompileThreadPool.shutdown(); + if (masterThread != null) { + try { + masterThread.awaitTermination(1, TimeUnit.MINUTES); + } catch (InterruptedException e) { + LOG.error("interrupted while waiting for masterThread to " + + "terminate", e); + } + } + if (reportCompileThreadPool != null) { + try { + reportCompileThreadPool.awaitTermination(1, TimeUnit.MINUTES); + } catch (InterruptedException e) { + LOG.error("interrupted while waiting for reportCompileThreadPool to " + + "terminate", e); + } + } if (!retainDiffs) clear(); }