From 64e962bc8fb1b11f7f84706c50e3b165ac7c61af Mon Sep 17 00:00:00 2001 From: byteblogs168 <598092184@qq.com> Date: Thu, 17 Aug 2023 15:52:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=202.1.1=201.=20=E4=BF=AE=E5=A4=8Dwindows?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F=E5=90=AF=E5=8A=A8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../retry/server/EasyRetryServerApplication.java | 12 ++++++++++++ pom.xml | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/EasyRetryServerApplication.java b/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/EasyRetryServerApplication.java index c3939ad9a..438354d7e 100644 --- a/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/EasyRetryServerApplication.java +++ b/easy-retry-server/src/main/java/com/aizuda/easy/retry/server/EasyRetryServerApplication.java @@ -1,6 +1,7 @@ package com.aizuda.easy.retry.server; import com.aizuda.easy.retry.server.server.NettyHttpServer; +import lombok.extern.slf4j.Slf4j; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; @@ -14,10 +15,12 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.transaction.annotation.EnableTransactionManagement; import java.util.TimeZone; +import java.util.concurrent.TimeUnit; @SpringBootApplication @MapperScan("com.aizuda.easy.retry.server.persistence.mybatis.mapper") @EnableTransactionManagement(proxyTargetClass = true) +@Slf4j public class EasyRetryServerApplication { @Bean @@ -36,7 +39,16 @@ public class EasyRetryServerApplication { @Bean public ApplicationRunner nettyStartupChecker(NettyHttpServer nettyHttpServer, ServletWebServerFactory serverFactory) { return args -> { + // 最长自旋10秒,保证nettyHttpServer启动完成 + int waitCount = 0; + while (!nettyHttpServer.isStarted() || waitCount > 100) { + log.info("--------> easy-retry netty server is staring...."); + TimeUnit.MILLISECONDS.sleep(100); + waitCount++; + } + if (!nettyHttpServer.isStarted()) { + log.error("--------> easy-retry netty server startup failure."); // Netty启动失败,停止Web服务和Spring Boot应用程序 serverFactory.getWebServer().stop(); SpringApplication.exit(SpringApplication.run(EasyRetryServerApplication.class)); diff --git a/pom.xml b/pom.xml index 913a76a15..2c679b1c2 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.8 1.8 1.8 - 2.1.0 + 2.1.1 1.0.0 4.1.94.Final 5.8.19