Merge pull request #1441 from metamx/queryResourceFlusher

Add flush prior to close on output stream in QueryResource
This commit is contained in:
Xavier Léauté 2015-07-17 16:32:52 -07:00
commit 6e8da5de86
1 changed files with 2 additions and 1 deletions

View File

@ -183,6 +183,7 @@ public class QueryResource
{
// json serializer will always close the yielder
jsonWriter.writeValue(outputStream, yielder);
outputStream.flush(); // Some types of OutputStream suppress flush errors in the .close() method.
outputStream.close();
final long queryTime = System.currentTimeMillis() - start;
@ -213,7 +214,7 @@ public class QueryResource
.build();
}
catch (Exception e) {
// make sure to close yieder if anything happened before starting to serialize the response.
// make sure to close yielder if anything happened before starting to serialize the response.
yielder.close();
throw Throwables.propagate(e);
}