From 1da5c977fa3bed096cbcd9cdeccbe2930dc006ce Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 9 Oct 2018 13:33:57 +0300 Subject: SSE: revert synchronization --- .../src/main/java/com/juick/server/ServerManager.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'juick-server/src/main') diff --git a/juick-server/src/main/java/com/juick/server/ServerManager.java b/juick-server/src/main/java/com/juick/server/ServerManager.java index 4f25929b..fce92705 100644 --- a/juick-server/src/main/java/com/juick/server/ServerManager.java +++ b/juick-server/src/main/java/com/juick/server/ServerManager.java @@ -244,16 +244,14 @@ public class ServerManager implements NotificationListener { public void sendSseEvent(Message msg, List subscribers) { List deadEmitters = new ArrayList<>(); - synchronized (this.getSessions()) { - this.sessions.stream().filter(s -> subscribers.contains(s.user)).forEach(session -> { - try { - session.getEmitter().send(msg); - } catch (Exception e) { - deadEmitters.add(session); - } - }); - this.sessions.removeAll(deadEmitters); - } + this.sessions.stream().filter(s -> subscribers.contains(s.user)).forEach(session -> { + try { + session.getEmitter().send(msg); + } catch (Exception e) { + deadEmitters.add(session); + } + }); + this.sessions.removeAll(deadEmitters); } public static class EventSession { -- cgit v1.2.3