HDFS-1990. Fix resource leaks in BlockReceiver.close(). Contributed by Uma Maheswara Rao G

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1143147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2011-07-05 17:19:07 +00:00
parent 1e5e03c73c
commit 5c778cdee3
2 changed files with 9 additions and 0 deletions

View File

@ -805,6 +805,9 @@ Trunk (unreleased changes)
HDFS-2053. Bug in INodeDirectory#computeContentSummary warning. HDFS-2053. Bug in INodeDirectory#computeContentSummary warning.
(Michael Noll via eli) (Michael Noll via eli)
HDFS-1990. Fix resource leaks in BlockReceiver.close(). (Uma Maheswara
Rao G via szetszwo)
Release 0.22.0 - Unreleased Release 0.22.0 - Unreleased
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -231,6 +231,9 @@ public void close() throws IOException {
} catch(IOException e) { } catch(IOException e) {
ioe = e; ioe = e;
} }
finally {
IOUtils.closeStream(checksumOut);
}
// close block file // close block file
try { try {
if (out != null) { if (out != null) {
@ -244,6 +247,9 @@ public void close() throws IOException {
} catch (IOException e) { } catch (IOException e) {
ioe = e; ioe = e;
} }
finally{
IOUtils.closeStream(out);
}
// disk check // disk check
if(ioe != null) { if(ioe != null) {
datanode.checkDiskError(ioe); datanode.checkDiskError(ioe);