Write any records in the queue before ending session.

This commit is contained in:
akwizgran
2020-05-25 18:07:16 +01:00
parent cc943be540
commit 8711e4782d
2 changed files with 6 additions and 0 deletions

View File

@@ -166,6 +166,9 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
dataToFlush = true;
}
}
// Write any records that were already in the queue
ThrowingRunnable<IOException> task;
while ((task = writerTasks.poll()) != null) task.run();
streamWriter.sendEndOfStream();
} catch (InterruptedException e) {
LOG.info("Interrupted while waiting for a record to write");

View File

@@ -95,6 +95,9 @@ class SimplexOutgoingSession implements SyncSession, EventListener {
if (task == CLOSE) break;
task.run();
}
// Write any records that were already in the queue
ThrowingRunnable<IOException> task;
while ((task = writerTasks.poll()) != null) task.run();
streamWriter.sendEndOfStream();
} catch (InterruptedException e) {
LOG.info("Interrupted while waiting for a record to write");