Skip to content

Commit

Permalink
feat: update hera-app version to 1.4-jdk21-2 RELEASE (#314)
Browse files Browse the repository at this point in the history
Co-authored-by: jifengzhilong <jifengzhilong@gmail.com>
  • Loading branch information
sadadw1 and jifengzhilong authored Mar 12, 2024
1 parent 850fdc1 commit f82a565
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ozhera-app/app-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-app</artifactId>
<version>1.4-jdk21-1</version>
<version>1.4-jdk21-2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>app-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ozhera-app/app-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-app</artifactId>
<version>1.4-jdk21-1</version>
<version>1.4-jdk21-2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>app-common</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ozhera-app/app-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-app</artifactId>
<version>1.4-jdk21-1</version>
<version>1.4-jdk21-2</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
3 changes: 2 additions & 1 deletion ozhera-app/app-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>ozhera-app</artifactId>
<groupId>run.mone</groupId>
<version>1.4-jdk21-1</version>
<version>1.4-jdk21-2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>app-service</artifactId>
Expand All @@ -20,6 +20,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>app-api</artifactId>
<version>${hera-app.release.version}</version>
</dependency>
<!-- mybatis-plus -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -206,6 +225,16 @@ private List<HeraMetaData> getList(Integer metaId, String ip, HeraMetaDataPortMo
return heraMetaDataMapper.selectList(queryWrapper);
}

/**
* only support dubbo port update concurrently
*/
private int updateByHostAndPort(HeraMetaData heraMetaData){
UpdateWrapper<HeraMetaData> 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.
Expand Down
9 changes: 7 additions & 2 deletions ozhera-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>run.mone</groupId>
<artifactId>ozhera-app</artifactId>
<version>1.4-jdk21-1</version>
<version>1.4-jdk21-2</version>
<packaging>pom</packaging>

<modules>
Expand All @@ -23,11 +23,16 @@
</modules>

<properties>
<hera-app.release.version>1.4-jdk21-1</hera-app.release.version>
<hera-app.release.version>1.4-jdk21-2</hera-app.release.version>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>run.mone</groupId>
<artifactId>app-api</artifactId>
<version>${hera-app.release.version}</version>
</dependency>
<dependency>
<groupId>run.mone</groupId>
<artifactId>app-service</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>app-api</artifactId>
<version>1.4-jdk21-1</version>
<version>1.4-jdk21-2</version>
</dependency>
<dependency>
<groupId>run.mone</groupId>
Expand Down

0 comments on commit f82a565

Please sign in to comment.