YARN-5915. ATS 1.5 FileSystemTimelineWriter causes flush() to be called after every event write. Contributed by Atul Sikaria

(cherry picked from commit 6b17d449bf)
This commit is contained in:
Jason Lowe 2016-12-02 16:58:43 +00:00
parent 5025a898e1
commit e6394e3a35
1 changed files with 2 additions and 2 deletions

View File

@ -286,6 +286,7 @@ private ObjectMapper createObjectMapper() {
mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector()); mapper.setAnnotationIntrospector(new JaxbAnnotationIntrospector());
mapper.setSerializationInclusion(Inclusion.NON_NULL); mapper.setSerializationInclusion(Inclusion.NON_NULL);
mapper.configure(Feature.CLOSE_CLOSEABLE, false); mapper.configure(Feature.CLOSE_CLOSEABLE, false);
mapper.configure(Feature.FLUSH_AFTER_WRITE_VALUE, false);
return mapper; return mapper;
} }
@ -366,6 +367,7 @@ public void close() {
public void flush() throws IOException { public void flush() throws IOException {
if (stream != null) { if (stream != null) {
jsonGenerator.flush();
stream.hflush(); stream.hflush();
} }
} }
@ -378,8 +380,6 @@ protected void prepareForWrite() throws IOException{
this.stream = createLogFileStream(fs, logPath); this.stream = createLogFileStream(fs, logPath);
this.jsonGenerator = new JsonFactory().createJsonGenerator(stream); this.jsonGenerator = new JsonFactory().createJsonGenerator(stream);
this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n")); this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
this.jsonGenerator.configure(
JsonGenerator.Feature.FLUSH_PASSED_TO_STREAM, false);
this.lastModifiedTime = Time.monotonicNow(); this.lastModifiedTime = Time.monotonicNow();
} }