| | |
| | | |
| | | @OnError |
| | | public void onError(Session session, @NonNull Throwable throwable) { |
| | | threadLocalData.remove(session.getId()); |
| | | wsServers.remove(this); |
| | | onClose(); |
| | | log.error("连接发生报错: {}", throwable.getMessage()); |
| | | throwable.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | if (!CollectionUtils.isEmpty(currencies)) { |
| | | Set<String> filtrationSet = currencies.stream() |
| | | .map(f -> f.getCurrency() + f.getBuy() + f.getSell()) |
| | | // .map(f -> f.getCurrency() + f.getBuy() + f.getSell()) //组合过滤 ,暂时不使用,直接过滤整个币种 |
| | | .map(f -> f.getCurrency()) |
| | | .collect(Collectors.toSet()); |
| | | redisValueMap.removeIf(data -> filtrationSet.contains(data.getBuyAndSell())); |
| | | redisValueMap.removeIf(data -> filtrationSet.contains(data.getBaseAsset())); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | // 关闭会话的方法 |
| | | private void closeSession(Session session, String reason) { |
| | | try { |
| | | threadLocalData.remove(session.getId()); |
| | | session.close(new CloseReason(CloseReason.CloseCodes.UNEXPECTED_CONDITION, reason)); |
| | | } catch (IOException e) { |
| | | log.error("强制断开连接----异常: {}", e.getMessage()); |
| | | } |
| | | wsServers.remove(this); |
| | | log.info(reason); |
| | | onClose(); |
| | | } |
| | | } |