HDFS-3505. DirectoryScanner does not join all threads in shutdown. Contributed Colin Patrick McCabe

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1347122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-06-06 21:01:59 +00:00
parent bad1c8bdd5
commit f159bd401a
2 changed files with 19 additions and 0 deletions

View File

@ -156,6 +156,9 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3266. DFSTestUtil#waitCorruptReplicas doesn't sleep between checks. HDFS-3266. DFSTestUtil#waitCorruptReplicas doesn't sleep between checks.
(Madhukara Phatak via atm) (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 Release 2.0.0-alpha - 05-23-2012
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -302,6 +302,22 @@ public class DirectoryScanner implements Runnable {
shouldRun = false; shouldRun = false;
if (masterThread != null) masterThread.shutdown(); if (masterThread != null) masterThread.shutdown();
if (reportCompileThreadPool != null) reportCompileThreadPool.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(); if (!retainDiffs) clear();
} }