final Path path,
Counter counter) throws IOException, InterruptedException {
FSDataOutputStream stream = fileSystem.create(path);
boolean succeed = false;
try {
CountOutputStream cstream;
if (LOG.isDebugEnabled()) {
cstream = new CountOutputStream(stream, counter) {
@Override
public void close() throws IOException {
LOG.debug(MessageFormat.format(
"Start closing output (file={0})",
path));
super.close();
LOG.debug(MessageFormat.format(
"Finish closing output (file={0})",
path));
}
};
} else {
cstream = new CountOutputStream(stream, counter);
}
ModelOutput<T> output = streamFormat.createOutput(dataType, path.toString(), cstream);
succeed = true;
return output;
} finally {