From 90f5ed89067c49051974e1905c4b2b3c93336b1c Mon Sep 17 00:00:00 2001 From: Anatoliy Sablin Date: Wed, 18 Oct 2017 23:02:33 +0300 Subject: Replaced the ArrayList by the LinkedList to avoid overhead array copying when the list is increased. --- juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'juick-ws') diff --git a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java index 550067b7..bdf6dba6 100644 --- a/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java +++ b/juick-ws/src/main/java/com/juick/ws/WebsocketComponent.java @@ -44,8 +44,8 @@ import javax.inject.Inject; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.net.URI; -import java.util.ArrayList; import java.util.Collections; +import java.util.LinkedList; import java.util.List; /** @@ -54,7 +54,7 @@ import java.util.List; public class WebsocketComponent extends TextWebSocketHandler implements ProtocolListener { private static final Logger logger = LoggerFactory.getLogger(WebsocketComponent.class); - private final List clients = Collections.synchronizedList(new ArrayList()); + private final List clients = Collections.synchronizedList(new LinkedList<>()); @Inject private UserService userService; -- cgit v1.2.3