@@ -0,0 +1,766 @@
+package com.lance.websocket.config;%0A%0Aimport java.util.Map;%0A%0Aimport org.springframework.web.socket.WebSocketSession;%0A%0Aimport com.google.common.collect.Maps;%0A%0Apublic final class SocketSessionHandler %7B%0A%09public static Map%3CString, WebSocketSession%3E sessions = Maps.newConcurrentMap();%0A%09%0A%09private SocketSessionHandler()%7B%7D%0A%09%0A%09private static class SocketSessionHandlerHolder %7B%0A%09%09private static final SocketSessionHandler handler = new SocketSessionHandler();%0A%09%7D%0A%09%0A%09public static SocketSessionHandler newInstance()%7B%0A%09%09return SocketSessionHandlerHolder.handler;%0A%09%7D%0A%09%0A%09public synchronized void addSession(WebSocketSession session)%7B%0A        sessions.put(session.getId(), session);%0A    %7D%0A%0A%09public synchronized void removeSession(String id) %7B%0A        sessions.remove(id);%0A    %7D%0A%7D%0A

add newConcurrentMap manage session