Catch hidden IOExceptions when writing
@@ -1117,19 +1117,15 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
}
@Override public void onDocument(JsonResponse response, Document document, Runnable ack, Consumer<String> onError) {
writes.add(() -> {
- response.writeDocumentValue(document);
+ loggingException(() -> response.writeDocumentValue(document));
ack.run();
});
if (writing.compareAndSet(false, true)) // Occupy only a single thread for writing.
defaultExecutor.execute(() -> {
while (writing.get()) {
- try {
for (Runnable write; (write = writes.poll()) != null; write.run());
- }
- finally {
writing.set( ! writes.isEmpty());
}
- }
});
}
@Override public void onEnd(JsonResponse response) throws IOException {
