HDFS-8183. Erasure Coding: Improve DFSStripedOutputStream closing of datastreamer threads. Contributed by Rakesh R.

This commit is contained in:
Zhe Zhang 2015-04-30 00:13:32 -07:00 committed by Zhe Zhang
parent f0628280c3
commit 1a31f1c303
2 changed files with 13 additions and 2 deletions

View File

@ -149,3 +149,6 @@
HDFS-8282. Erasure coding: move striped reading logic to StripedBlockUtil.
(Zhe Zhang)
HDFS-8183. Erasure Coding: Improve DFSStripedOutputStream closing of
datastreamer threads. (Rakesh R via Zhe Zhang)

View File

@ -331,18 +331,26 @@ boolean isClosed() {
// interrupt datastreamer if force is true
@Override
protected void closeThreads(boolean force) throws IOException {
int index = 0;
boolean exceptionOccurred = false;
for (StripedDataStreamer streamer : streamers) {
try {
streamer.close(force);
streamer.join();
streamer.closeSocket();
} catch (InterruptedException e) {
throw new IOException("Failed to shutdown streamer");
} catch (InterruptedException | IOException e) {
DFSClient.LOG.error("Failed to shutdown streamer: name="
+ streamer.getName() + ", index=" + index + ", file=" + src, e);
exceptionOccurred = true;
} finally {
streamer.setSocketToNull();
setClosed();
index++;
}
}
if (exceptionOccurred) {
throw new IOException("Failed to shutdown streamer");
}
}
/**