From f82a5654942164dd876c33601fa2ec6e150591d9 Mon Sep 17 00:00:00 2001 From: EricDing <128116675+sadadw1@users.noreply.github.com> Date: Tue, 12 Mar 2024 15:28:38 +0800 Subject: [PATCH] feat: update hera-app version to 1.4-jdk21-2 RELEASE (#314) Co-authored-by: jifengzhilong --- ozhera-app/app-api/pom.xml | 2 +- ozhera-app/app-common/pom.xml | 2 +- ozhera-app/app-server/pom.xml | 2 +- ozhera-app/app-service/pom.xml | 3 +- .../mq/RocketMqHeraMetaDataConsumer.java | 29 +++++++++++++++++++ ozhera-app/pom.xml | 9 ++++-- pom.xml | 2 +- 7 files changed, 42 insertions(+), 7 deletions(-) diff --git a/ozhera-app/app-api/pom.xml b/ozhera-app/app-api/pom.xml index b1c5d4098..12c678570 100644 --- a/ozhera-app/app-api/pom.xml +++ b/ozhera-app/app-api/pom.xml @@ -6,7 +6,7 @@ run.mone ozhera-app - 1.4-jdk21-1 + 1.4-jdk21-2 4.0.0 app-api diff --git a/ozhera-app/app-common/pom.xml b/ozhera-app/app-common/pom.xml index 81caa3931..d3c19c8b8 100644 --- a/ozhera-app/app-common/pom.xml +++ b/ozhera-app/app-common/pom.xml @@ -5,7 +5,7 @@ run.mone ozhera-app - 1.4-jdk21-1 + 1.4-jdk21-2 4.0.0 app-common diff --git a/ozhera-app/app-server/pom.xml b/ozhera-app/app-server/pom.xml index 42d1ff23a..778be9fe1 100644 --- a/ozhera-app/app-server/pom.xml +++ b/ozhera-app/app-server/pom.xml @@ -5,7 +5,7 @@ run.mone ozhera-app - 1.4-jdk21-1 + 1.4-jdk21-2 4.0.0 diff --git a/ozhera-app/app-service/pom.xml b/ozhera-app/app-service/pom.xml index caddef9e4..0b2aedcc3 100644 --- a/ozhera-app/app-service/pom.xml +++ b/ozhera-app/app-service/pom.xml @@ -5,7 +5,7 @@ ozhera-app run.mone - 1.4-jdk21-1 + 1.4-jdk21-2 4.0.0 app-service @@ -20,6 +20,7 @@ run.mone app-api + ${hera-app.release.version} diff --git a/ozhera-app/app-service/src/main/java/com/xiaomi/mone/app/service/mq/RocketMqHeraMetaDataConsumer.java b/ozhera-app/app-service/src/main/java/com/xiaomi/mone/app/service/mq/RocketMqHeraMetaDataConsumer.java index 0c094de53..ad18ef9b5 100644 --- a/ozhera-app/app-service/src/main/java/com/xiaomi/mone/app/service/mq/RocketMqHeraMetaDataConsumer.java +++ b/ozhera-app/app-service/src/main/java/com/xiaomi/mone/app/service/mq/RocketMqHeraMetaDataConsumer.java @@ -17,6 +17,7 @@ import com.alibaba.nacos.api.config.annotation.NacosValue; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.google.gson.Gson; import com.xiaomi.mone.app.api.model.HeraMetaDataMessage; import com.xiaomi.mone.app.api.model.HeraMetaDataPortModel; @@ -175,6 +176,24 @@ private void consumeMessage(MessageExt message) { } } } + } else if ("update".equals(heraMetaDataMessage.getOperator())) { + int availablePort = getAvailablePort(heraMetaDataMessage.getPort()); + if (availablePort > 0) { + // Check whether synchronous data blocking is required to prevent repeated data insertion + if (waitSyncData()) { + // Gets a distributed lock to prevent repeated insertions + String key = heraMetaDataMessage.getMetaId() + "_" + heraMetaDataMessage.getHost() + "_" + availablePort; + if (redisService.getDisLock(key)) { + try { + Date date = new Date(); + heraMetaData.setUpdateTime(date); + updateByHostAndPort(heraMetaData); + } finally { + redisService.del(key); + } + } + } + } } } catch (Throwable ex) { log.error("RocketMqHeraMetaDataConsumer#consumeMessage error:" + ex.getMessage(), ex); @@ -206,6 +225,16 @@ private List getList(Integer metaId, String ip, HeraMetaDataPortMo return heraMetaDataMapper.selectList(queryWrapper); } + /** + * only support dubbo port update concurrently + */ + private int updateByHostAndPort(HeraMetaData heraMetaData){ + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.eq("host", heraMetaData.getHost()); + updateWrapper.eq("port -> '$.dubboPort'", heraMetaData.getPort().getDubboPort()); + return heraMetaDataMapper.update(heraMetaData, updateWrapper); + } + /** * Do not continue the operation until data synchronization is complete. * In this case, data is repeatedly inserted during data synchronization. diff --git a/ozhera-app/pom.xml b/ozhera-app/pom.xml index 23ed657f0..135f2fc56 100644 --- a/ozhera-app/pom.xml +++ b/ozhera-app/pom.xml @@ -12,7 +12,7 @@ run.mone ozhera-app - 1.4-jdk21-1 + 1.4-jdk21-2 pom @@ -23,11 +23,16 @@ - 1.4-jdk21-1 + 1.4-jdk21-2 + + run.mone + app-api + ${hera-app.release.version} + run.mone app-service diff --git a/pom.xml b/pom.xml index a302f450e..4b8e888e1 100644 --- a/pom.xml +++ b/pom.xml @@ -525,7 +525,7 @@ run.mone app-api - 1.4-jdk21-1 + 1.4-jdk21-2 run.mone