Synchronize plain text output of incoming messages

This commit is contained in:
AsamK 2021-11-10 10:30:24 +01:00
parent 54d8ee2a40
commit 25314b1d17

View file

@ -25,6 +25,12 @@ public class ReceiveMessageHandler implements Manager.ReceiveMessageHandler {
@Override
public void handleMessage(MessageEnvelope envelope, Throwable exception) {
synchronized (writer) {
handleMessageInternal(envelope, exception);
}
}
private void handleMessageInternal(MessageEnvelope envelope, Throwable exception) {
var source = envelope.sourceAddress();
writer.println("Envelope from: {} (device: {})",
source.map(this::formatContact).orElse("unknown source"),