From f53538d230440f16948a12a34ffe587edcd0f245 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 28 Jun 2016 14:53:37 +0300 Subject: fixes --- src/main/java/com/juick/ws/WebsocketComponent.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/com/juick/ws/WebsocketComponent.java b/src/main/java/com/juick/ws/WebsocketComponent.java index 83e811a6..7399c298 100644 --- a/src/main/java/com/juick/ws/WebsocketComponent.java +++ b/src/main/java/com/juick/ws/WebsocketComponent.java @@ -97,19 +97,18 @@ public class WebsocketComponent extends TextWebSocketHandler { } } if (sockSubscr != null) { - synchronized (clients) { - clients.add(sockSubscr); - } + clients.add(sockSubscr); } } @Override public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { synchronized (clients) { - clients.stream().filter(c -> c.session.equals(session)).forEach(c -> { + clients.stream().filter(c -> c.session.getId().equals(session.getId())).forEach(c -> { logger.info(String.format("session %s closed with status %s", c.clientName, status.getCode())); clients.remove(c); }); } + } class SocketSubscribed { -- cgit v1.2.3