HDFS-15868. Possible Resource Leak in EditLogFileOutputStream (#2736). Contributed by Narges Shadab.
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
3d4ea4b336
commit
f5f3fc6fe9
@ -88,7 +88,12 @@ public EditLogFileOutputStream(Configuration conf, File name, int size)
|
|||||||
} else {
|
} else {
|
||||||
rp = new RandomAccessFile(name, "rws");
|
rp = new RandomAccessFile(name, "rws");
|
||||||
}
|
}
|
||||||
fp = new FileOutputStream(rp.getFD()); // open for append
|
try {
|
||||||
|
fp = new FileOutputStream(rp.getFD()); // open for append
|
||||||
|
} catch (IOException e) {
|
||||||
|
IOUtils.closeStream(rp);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
fc = rp.getChannel();
|
fc = rp.getChannel();
|
||||||
fc.position(fc.size());
|
fc.position(fc.size());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user