if (logMessage instanceof StopMeasurementLogMessage) {
// TODO(lukes): this is a blocking write, perhaps we should perform it in a non
// blocking manner to keep this thread only blocking in one place. This would
// complicate error handling, but may increase performance since it would free this
// thread up to handle other messages
streamService.writeLine(gson.toJson(new ShouldContinueMessage(!doneCollecting)));
if (doneCollecting) {
streamService.closeWriter();
}
}
break;