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 1/2] =?UTF-8?q?feat:=202.1.1=201.=20=E4=BF=AE=E5=A4=8Dwind?= =?UTF-8?q?ows=E6=93=8D=E4=BD=9C=E7=B3=BB=E7=BB=9F=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=A4=B1=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 From 4b8f2a3313aeb7c173bf924827ff6baeaddd3277 Mon Sep 17 00:00:00 2001 From: byteblogs168 <598092184@qq.com> Date: Thu, 17 Aug 2023 18:29:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=202.2.0=201.=20=E4=BC=98=E5=8C=96pom?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easy-retry-client-core/pom.xml | 4 ---- easy-retry-common/easy-retry-common-core/pom.xml | 11 ++++++++++- .../easy-retry-datasource-template/pom.xml | 2 +- .../retry/template/datasource/enums/DbTypeEnum.java | 4 ++-- .../template/datasource/utils/RequestDataHelper.java | 6 +++--- .../easy-retry-mariadb-datasource/pom.xml | 4 ---- .../easy-retry-mysql-datasource/pom.xml | 8 -------- .../easy-retry-postgres-datasource/pom.xml | 8 -------- easy-retry-server/pom.xml | 4 ---- pom.xml | 12 +++++++++++- 10 files changed, 27 insertions(+), 36 deletions(-) diff --git a/easy-retry-client-core/pom.xml b/easy-retry-client-core/pom.xml index 6c85a4494..6c334736d 100644 --- a/easy-retry-client-core/pom.xml +++ b/easy-retry-client-core/pom.xml @@ -38,10 +38,6 @@ com.github.rholder guava-retrying - - cn.hutool - hutool-all - com.aizuda easy-retry-common-core diff --git a/easy-retry-common/easy-retry-common-core/pom.xml b/easy-retry-common/easy-retry-common-core/pom.xml index 3acf7b30d..8e10b8f4f 100644 --- a/easy-retry-common/easy-retry-common-core/pom.xml +++ b/easy-retry-common/easy-retry-common-core/pom.xml @@ -22,6 +22,7 @@ org.springframework.boot spring-boot-starter-web + provided org.projectlombok @@ -43,7 +44,15 @@ cn.hutool - hutool-all + hutool-http + + + cn.hutool + hutool-extra + + + cn.hutool + hutool-crypto diff --git a/easy-retry-datasource/easy-retry-datasource-template/pom.xml b/easy-retry-datasource/easy-retry-datasource-template/pom.xml index 556851a4e..b61dcc342 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/pom.xml +++ b/easy-retry-datasource/easy-retry-datasource-template/pom.xml @@ -38,7 +38,7 @@ com.aizuda - easy-retry-client-core + easy-retry-common-server-api diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java index 4ad5acdef..79a6e5464 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java @@ -1,6 +1,6 @@ package com.aizuda.easy.retry.template.datasource.enums; -import com.aizuda.easy.retry.client.core.exception.EasyRetryClientException; +import com.aizuda.easy.retry.template.datasource.exception.EasyRetryDatasourceException; import com.baomidou.mybatisplus.annotation.DbType; import lombok.AllArgsConstructor; import lombok.Getter; @@ -32,6 +32,6 @@ public enum DbTypeEnum { } } - throw new EasyRetryClientException("暂不支持此数据库 [{}]", db); + throw new EasyRetryDatasourceException("暂不支持此数据库 [{}]", db); } } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/RequestDataHelper.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/RequestDataHelper.java index ede409f2b..1998d8e77 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/RequestDataHelper.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/RequestDataHelper.java @@ -1,6 +1,6 @@ package com.aizuda.easy.retry.template.datasource.utils; -import com.aizuda.easy.retry.client.core.exception.EasyRetryClientException; +import com.aizuda.easy.retry.template.datasource.exception.EasyRetryDatasourceException; import com.aizuda.easy.retry.template.datasource.persistence.mapper.GroupConfigMapper; import com.aizuda.easy.retry.template.datasource.persistence.po.GroupConfig; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -58,7 +58,7 @@ public class RequestDataHelper { public static void setPartition(String groupName) { if (StringUtils.isBlank(groupName)) { - throw new EasyRetryClientException("组名称不能为空"); + throw new EasyRetryDatasourceException("组名称不能为空"); } GroupConfigMapper groupConfigMapper = SpringContext.getBeanByType(GroupConfigMapper.class); @@ -66,7 +66,7 @@ public class RequestDataHelper { GroupConfig groupConfig = groupConfigMapper.selectOne(new LambdaQueryWrapper() .eq(GroupConfig::getGroupName, groupName)); if (Objects.isNull(groupConfig)) { - throw new EasyRetryClientException("groupName:[{}]不存在", groupName); + throw new EasyRetryDatasourceException("groupName:[{}]不存在", groupName); } setPartition(groupConfig.getGroupPartition()); diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/pom.xml b/easy-retry-datasource/easy-retry-mariadb-datasource/pom.xml index b24dd88bd..ead58fc41 100644 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/pom.xml +++ b/easy-retry-datasource/easy-retry-mariadb-datasource/pom.xml @@ -25,10 +25,6 @@ lombok true - - com.aizuda - easy-retry-common-core - com.aizuda easy-retry-datasource-template diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/pom.xml b/easy-retry-datasource/easy-retry-mysql-datasource/pom.xml index b2a92d5ee..3b46f3129 100644 --- a/easy-retry-datasource/easy-retry-mysql-datasource/pom.xml +++ b/easy-retry-datasource/easy-retry-mysql-datasource/pom.xml @@ -25,14 +25,6 @@ lombok true - - com.aizuda - easy-retry-common-core - - - com.baomidou - mybatis-plus-boot-starter - mysql mysql-connector-java diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/pom.xml b/easy-retry-datasource/easy-retry-postgres-datasource/pom.xml index aa1d5b9f7..09becbc17 100644 --- a/easy-retry-datasource/easy-retry-postgres-datasource/pom.xml +++ b/easy-retry-datasource/easy-retry-postgres-datasource/pom.xml @@ -25,14 +25,6 @@ lombok true - - com.aizuda - easy-retry-common-core - - - com.baomidou - mybatis-plus-boot-starter - com.aizuda easy-retry-datasource-template diff --git a/easy-retry-server/pom.xml b/easy-retry-server/pom.xml index dd245433a..1c1dd3e9e 100644 --- a/easy-retry-server/pom.xml +++ b/easy-retry-server/pom.xml @@ -77,10 +77,6 @@ com.aizuda easy-retry-common-client-api - - cn.hutool - hutool-all - com.auth0 java-jwt diff --git a/pom.xml b/pom.xml index 53ed7fa9e..cf8d257f6 100644 --- a/pom.xml +++ b/pom.xml @@ -89,7 +89,17 @@ cn.hutool - hutool-all + hutool-http + ${hutool-all.version} + + + cn.hutool + hutool-extra + ${hutool-all.version} + + + cn.hutool + hutool-crypto ${hutool-all.version}