From 361037ab9a95e70d37e069dd795566d2ec1e0a98 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Sun, 10 Apr 2022 14:14:11 +0200 Subject: [PATCH] Make NetworkConnection send(T data) method synchronized --- .../java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java b/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java index 15cc22b..6c58849 100644 --- a/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java +++ b/protocol/src/main/java/ch/zhaw/pm2/multichat/protocol/NetworkHandler.java @@ -305,7 +305,7 @@ public class NetworkHandler { * @param data data object of type T to be submitted through the connection. * @throws IOException if an error occurs (e.g. connection interrupted while sending, ...) */ - public void send(T data) throws IOException { + public synchronized void send(T data) throws IOException { ObjectOutputStream outputStream = new ObjectOutputStream(socket.getOutputStream()); outputStream.writeObject(data); }