From e816946bb6e8f6b88045e565a3368c2367e7158a Mon Sep 17 00:00:00 2001
From: zj <1772600164@qq.com>
Date: Tue, 15 Jul 2025 14:09:33 +0800
Subject: [PATCH] 1
---
kucoinClient/src/main/java/org/example/kucoinclient/WsBean/KucoinWsBean.java | 34 ++--------------------------------
1 files changed, 2 insertions(+), 32 deletions(-)
diff --git a/kucoinClient/src/main/java/org/example/kucoinclient/WsBean/KucoinWsBean.java b/kucoinClient/src/main/java/org/example/kucoinclient/WsBean/KucoinWsBean.java
index 4d721e2..906eef6 100644
--- a/kucoinClient/src/main/java/org/example/kucoinclient/WsBean/KucoinWsBean.java
+++ b/kucoinClient/src/main/java/org/example/kucoinclient/WsBean/KucoinWsBean.java
@@ -39,15 +39,12 @@
private CurrencySerivceImpl currencyService;
@Autowired
- private ConfigurableApplicationContext context;
-
- @Autowired
@Qualifier("threadPoolTaskExecutor")
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
@Bean
public void kucoinWebsocketRunClientMap() throws Exception {
- List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "kucoin"));
+ List<Currency> mexc = currencyService.list(new LambdaQueryWrapper<Currency>().eq(Currency::getSource, "kucoin").eq(Currency::getQuoteAsset,"USDT"));
if (!CollectionUtils.isEmpty(mexc)) {
String result = doPost();
JSONObject jsonObject = new JSONObject(result);
@@ -63,38 +60,11 @@
// 使用自定义线程池提交任务
threadPoolTaskExecutor.execute(() -> {
- try {
- new KucoinClient(sublist,token).start();
- } catch (Exception e) {
- run();
- }
+ new KucoinClient(sublist,token).start();
});
}
}
- }
-
- private boolean runExecuted = false;
- private synchronized void run() {
-
- if (runExecuted) {
- return; // 已经执行过,直接返回
- }
- runExecuted = true;
- log.info("ws 异常开始重启");
- Thread restartThread = new Thread(() -> {
- try {
- SpringApplication.exit(context, () -> 0);
- SpringApplication.run(KucoinClientApplication.class);
- log.info("ws 重启成功");
- } catch (Exception e) {
- e.printStackTrace();
- log.error("ws 重启失败");
- }
- });
- restartThread.setDaemon(false);
- restartThread.start();
- log.info("ws 重启失败");
}
public static String doPost() throws Exception {
--
Gitblit v1.9.3