HDFS-8253. DFSStripedOutputStream.closeThreads releases cellBuffers multiple times. Contributed by Kai Sasaki

This commit is contained in:
Tsz-Wo Nicholas Sze 2015-06-24 23:39:05 +08:00
parent d920cdab91
commit 093907d728
2 changed files with 18 additions and 12 deletions

View File

@ -320,3 +320,6 @@
HDFS-8567. Erasure Coding: SafeMode handles file smaller than a full stripe. HDFS-8567. Erasure Coding: SafeMode handles file smaller than a full stripe.
(Walter Su via jing9) (Walter Su via jing9)
HDFS-8253. DFSStripedOutputStream.closeThreads releases cellBuffers
multiple times. (Kai Sasaki via szetszwo)

View File

@ -494,22 +494,25 @@ public class DFSStripedOutputStream extends DFSOutputStream {
@Override @Override
protected void closeThreads(boolean force) throws IOException { protected void closeThreads(boolean force) throws IOException {
final MultipleIOException.Builder b = new MultipleIOException.Builder(); final MultipleIOException.Builder b = new MultipleIOException.Builder();
try {
for (StripedDataStreamer streamer : streamers) { for (StripedDataStreamer streamer : streamers) {
try { try {
streamer.close(force); streamer.close(force);
streamer.join(); streamer.join();
streamer.closeSocket(); streamer.closeSocket();
} catch(Exception e) { } catch (Exception e) {
try { try {
handleStreamerFailure("force=" + force, e); handleStreamerFailure("force=" + force, e);
} catch(IOException ioe) { } catch (IOException ioe) {
b.add(ioe); b.add(ioe);
} }
} finally { } finally {
streamer.setSocketToNull(); streamer.setSocketToNull();
setClosed();
} }
} }
} finally {
setClosed();
}
final IOException ioe = b.build(); final IOException ioe = b.build();
if (ioe != null) { if (ioe != null) {
throw ioe; throw ioe;