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

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1347117 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-06-06 20:56:26 +00:00
parent 8ad1fcb3c3
commit 8813f42175
2 changed files with 19 additions and 0 deletions

View File

@ -307,6 +307,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();
} }