1
zj
2024-08-05 4f7387acdce01089ff60130946f79e6e2ba9a8fa
1
4 files modified
4 files added
171 ■■■■■ changed files
bitgetsClient/src/main/java/org/example/bitgetsclient/BitgetsClientApplication.java 2 ●●●●● patch | view | raw | blame | history
bitgetsClient/src/main/java/org/example/bitgetsclient/task/RunTask.java 43 ●●●●● patch | view | raw | blame | history
geteClient/src/main/java/org/example/geteclient/GeteClientApplication.java 2 ●●●●● patch | view | raw | blame | history
geteClient/src/main/java/org/example/geteclient/task/RunTask.java 40 ●●●●● patch | view | raw | blame | history
kucoinClient/src/main/java/org/example/kucoinclient/KucoinClientApplication.java 2 ●●●●● patch | view | raw | blame | history
kucoinClient/src/main/java/org/example/kucoinclient/task/RunTask.java 40 ●●●●● patch | view | raw | blame | history
mexcClient/src/main/java/org/example/mexcclient/MexcClientApplication.java 2 ●●●●● patch | view | raw | blame | history
mexcClient/src/main/java/org/example/mexcclient/task/RunTask.java 40 ●●●●● patch | view | raw | blame | history
bitgetsClient/src/main/java/org/example/bitgetsclient/BitgetsClientApplication.java
@@ -2,7 +2,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class BitgetsClientApplication {
bitgetsClient/src/main/java/org/example/bitgetsclient/task/RunTask.java
New file
@@ -0,0 +1,43 @@
package org.example.bitgetsclient.task;
import lombok.extern.slf4j.Slf4j;
import org.example.bitgetsclient.BitgetsClientApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.function.ServerResponse;
import javax.servlet.http.HttpServletRequest;
/**
 * @program: demo
 * @description:
 * @create: 2024-08-05 10:04
 **/
@Component
@Slf4j
public class RunTask {
    @Autowired
    private ConfigurableApplicationContext context;
    @Scheduled(cron = "0 0 */3 * * ?")
    public void restart() {
        Thread restartThread = new Thread(() -> {
            try {
                SpringApplication.exit(context, () -> 0);
                SpringApplication.run(BitgetsClientApplication.class);
                log.info("bitgets ws 重启成功");
            } catch (Exception e) {
                e.printStackTrace();
                log.error("bitgets ws 重启失败");
            }
        });
        restartThread.setDaemon(false);
        restartThread.start();
        log.info("bitgets ws 重启失败");
    }
}
geteClient/src/main/java/org/example/geteclient/GeteClientApplication.java
@@ -2,7 +2,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class GeteClientApplication {
geteClient/src/main/java/org/example/geteclient/task/RunTask.java
New file
@@ -0,0 +1,40 @@
package org.example.geteclient.task;
import lombok.extern.slf4j.Slf4j;
import org.example.geteclient.GeteClientApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * @program: demo
 * @description:
 * @create: 2024-08-05 10:04
 **/
@Component
@Slf4j
public class RunTask {
    @Autowired
    private ConfigurableApplicationContext context;
    @Scheduled(cron = "0 0 */3 * * ?")
    public void restart() {
        Thread restartThread = new Thread(() -> {
            try {
                SpringApplication.exit(context, () -> 0);
                SpringApplication.run(GeteClientApplication.class);
                log.info("bitgets ws 重启成功");
            } catch (Exception e) {
                e.printStackTrace();
                log.error("bitgets ws 重启失败");
            }
        });
        restartThread.setDaemon(false);
        restartThread.start();
        log.info("bitgets ws 重启失败");
    }
}
kucoinClient/src/main/java/org/example/kucoinclient/KucoinClientApplication.java
@@ -2,7 +2,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class KucoinClientApplication {
kucoinClient/src/main/java/org/example/kucoinclient/task/RunTask.java
New file
@@ -0,0 +1,40 @@
package org.example.kucoinclient.task;
import lombok.extern.slf4j.Slf4j;
import org.example.kucoinclient.KucoinClientApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * @program: demo
 * @description:
 * @create: 2024-08-05 10:04
 **/
@Component
@Slf4j
public class RunTask {
    @Autowired
    private ConfigurableApplicationContext context;
    @Scheduled(cron = "0 0 */3 * * ?")
    public void restart() {
        Thread restartThread = new Thread(() -> {
            try {
                SpringApplication.exit(context, () -> 0);
                SpringApplication.run(KucoinClientApplication.class);
                log.info("bitgets ws 重启成功");
            } catch (Exception e) {
                e.printStackTrace();
                log.error("bitgets ws 重启失败");
            }
        });
        restartThread.setDaemon(false);
        restartThread.start();
        log.info("bitgets ws 重启失败");
    }
}
mexcClient/src/main/java/org/example/mexcclient/MexcClientApplication.java
@@ -2,7 +2,9 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class MexcClientApplication {
mexcClient/src/main/java/org/example/mexcclient/task/RunTask.java
New file
@@ -0,0 +1,40 @@
package org.example.mexcclient.task;
import lombok.extern.slf4j.Slf4j;
import org.example.mexcclient.MexcClientApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * @program: demo
 * @description:
 * @create: 2024-08-05 10:04
 **/
@Component
@Slf4j
public class RunTask {
    @Autowired
    private ConfigurableApplicationContext context;
    @Scheduled(cron = "0 0 */3 * * ?")
    public void restart() {
        Thread restartThread = new Thread(() -> {
            try {
                SpringApplication.exit(context, () -> 0);
                SpringApplication.run(MexcClientApplication.class);
                log.info("bitgets ws 重启成功");
            } catch (Exception e) {
                e.printStackTrace();
                log.error("bitgets ws 重启失败");
            }
        });
        restartThread.setDaemon(false);
        restartThread.start();
        log.info("bitgets ws 重启失败");
    }
}