diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java index 55d6bd22df2..5ebff414e55 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/FileSystemTimelineWriter.java @@ -286,6 +286,7 @@ public class FileSystemTimelineWriter extends TimelineWriter{ mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector()); mapper.setSerializationInclusion(Inclusion.NON_NULL); mapper.configure(Feature.CLOSE_CLOSEABLE, false); + mapper.configure(Feature.FLUSH_AFTER_WRITE_VALUE, false); return mapper; } @@ -366,6 +367,7 @@ public class FileSystemTimelineWriter extends TimelineWriter{ public void flush() throws IOException { if (stream != null) { + jsonGenerator.flush(); stream.hflush(); } } @@ -378,8 +380,6 @@ public class FileSystemTimelineWriter extends TimelineWriter{ this.stream = createLogFileStream(fs, logPath); this.jsonGenerator = new JsonFactory().createJsonGenerator(stream); this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n")); - this.jsonGenerator.configure( - JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM, false); this.lastModifiedTime = Time.monotonicNow(); }