| | |
| | | import org.example.util.RedisUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Qualifier; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | import javax.websocket.*; |
| | | import javax.websocket.server.ServerEndpoint; |
| | | import java.io.IOException; |
| | |
| | | @OnError |
| | | public void onError(Session session, @NonNull Throwable throwable) { |
| | | onClose(); |
| | | onlineCount.decrementAndGet(); |
| | | log.error("连接发生报错: {}", throwable.getMessage()); |
| | | throwable.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @PreDestroy |
| | | public void shutdownExecutor() { |
| | | threadPoolTaskExecutor.shutdown(); |
| | | } |
| | | |
| | | private static final Gson gson = new Gson(); |
| | | private String megFiltration(WsBo wsBo,String message) throws JsonProcessingException { |
| | | List<MarketDataOut> redisValueMap = gson.fromJson(message, new TypeToken<List<MarketDataOut>>() {}.getType()); |