HDFS-3048. Small race in BlockManager#close. Contributed by Andy Isaacson

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1373665 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-08-15 22:45:05 +00:00
parent e26c63b238
commit 3f1998b7ba
2 changed files with 13 additions and 4 deletions

View File

@ -456,6 +456,8 @@ Release 2.0.1-alpha - UNRELEASED
header when offset is specified and length is omitted. header when offset is specified and length is omitted.
(Ravi Prakash via szetszwo) (Ravi Prakash via szetszwo)
HDFS-3048. Small race in BlockManager#close. (Andy Isaacson via eli)
BREAKDOWN OF HDFS-3042 SUBTASKS BREAKDOWN OF HDFS-3042 SUBTASKS
HDFS-2185. HDFS portion of ZK-based FailoverController (todd) HDFS-2185. HDFS portion of ZK-based FailoverController (todd)

View File

@ -374,10 +374,17 @@ public class BlockManager {
} }
public void close() { public void close() {
if (pendingReplications != null) pendingReplications.stop(); try {
blocksMap.close(); if (replicationThread != null) {
datanodeManager.close(); replicationThread.interrupt();
if (replicationThread != null) replicationThread.interrupt(); replicationThread.join(3000);
}
} catch (InterruptedException ie) {
} finally {
if (pendingReplications != null) pendingReplications.stop();
blocksMap.close();
datanodeManager.close();
}
} }
/** @return the datanodeManager */ /** @return the datanodeManager */