Skip to content

Commit

Permalink
[aquery] only flush the relevant output channel.
Browse files Browse the repository at this point in the history
Depending on the output type.

PiperOrigin-RevId: 554730946
Change-Id: I62c2fbc62dcf1e9022cc0cccad9d1bd244bea982
  • Loading branch information
joeleba authored and copybara-github committed Aug 8, 2023
1 parent 9d30849 commit 6504a25
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,19 @@ void addTaskToQueue(Message message, int fieldNumber, String messageLabel) {

@Override
public void close() throws IOException {
outputStream.flush();
codedOutputStream.flush();
printStream.flush();
switch (outputType) {
case BINARY:
codedOutputStream.flush();
break;
case DELIMITED_BINARY:
outputStream.flush();
break;
case TEXT:
printStream.flush();
break;
default:
throw new IllegalStateException("Unknown outputType: " + outputType);
}
}

// Only runs on 1 single thread.
Expand Down

0 comments on commit 6504a25

Please sign in to comment.