|
@@ -322,6 +322,7 @@ public class LoadGenerator extends Configured implements Tool {
|
|
|
private void genFile(Path file, long fileSize) throws IOException {
|
|
|
long startTimestamp = Time.monotonicNow();
|
|
|
FSDataOutputStream out = null;
|
|
|
+ boolean isOutClosed = false;
|
|
|
try {
|
|
|
out = fc.create(file,
|
|
|
EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE),
|
|
@@ -337,11 +338,15 @@ public class LoadGenerator extends Configured implements Tool {
|
|
|
i -= s;
|
|
|
}
|
|
|
|
|
|
- startTimestamp = Time.monotonicNow();
|
|
|
- executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTimestamp);
|
|
|
+ startTime = Time.monotonicNow();
|
|
|
+ out.close();
|
|
|
+ executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTime);
|
|
|
numOfOps[WRITE_CLOSE]++;
|
|
|
+ isOutClosed = true;
|
|
|
} finally {
|
|
|
- IOUtils.cleanup(LOG, out);
|
|
|
+ if (!isOutClosed && out != null) {
|
|
|
+ out.close();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|