| | |
| | | @OnOpen |
| | | public void onOpen(Session session, EndpointConfig config) { |
| | | this.session = session; |
| | | this.httpSession = (HttpSession) config.getUserProperties().get("httpSession"); |
| | | } |
| | | |
| | | @OnMessage |
| | | public synchronized void onMessage(Session session, String message) { |
| | | AnalysisDto dto = ActionUtil.getGson("yyyy-MM-dd HH:mm:ss").fromJson(message,AnalysisDto.class); |
| | | UserInf user = (UserInf) httpSession.getAttribute("user"); |
| | | final int userId = user.getUId().intValue(); |
| | | thread = new Thread("Thread_Analysis") { |
| | | @Override |
| | | public void run() { |
| | |
| | | Thread thread = currentThread(); |
| | | threadFlagMap.put(thread.getId(), true); |
| | | try { |
| | | Response res = service.getAnalysisSocket(dto,userId); |
| | | Response res = service.getAnalysisSocket(dto); |
| | | if (session.isOpen()) { |
| | | //推送信息 |
| | | synchronized (session) { |