Skip to content

Commit

Permalink
upgrade monitor to JDK21 (#154)
Browse files Browse the repository at this point in the history
* upgrade monitor to JDK21

* update
  • Loading branch information
jifengzhilong authored Nov 20, 2023
1 parent 9e1c25a commit 197e03a
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ozhera-monitor-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-build-8:
check-build-21:
name: ozhera-monitor test
runs-on: ubuntu-latest
steps:
- name: Setup Maven Action
uses: s4u/[email protected]
with:
java-version: 8
java-version: 21
#settings-properties: '[{"propertyName1": "propertyValue1"}, {"propertyName2": "propertyValue2"}]'

- run: echo '<settings> <interactiveMode>false</interactiveMode> <profiles> <profile> <repositories> <repository> <snapshots /> <id>ossrh</id> <name>ossrh-snapshot</name> <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <snapshots /> <id>ossrh</id> <name>ossrh-snapshot</name> <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url> </pluginRepository> </pluginRepositories> <id>artifactory</id> </profile> </profiles> <activeProfiles> <activeProfile>artifactory</activeProfile> </activeProfiles> <servers> <server> <id>github</id> <username>${env.GITHUB_ACTOR}</username> <password>${env.GITHUB_TOKEN}</password> </server> </servers> <mirrors/> <proxies/></settings>' > ~/.m2/settings.xml

- run: cd ozhera-monitor; mvn -U clean package --fail-at-end -Dmaven.test.skip=true
- run: cd ozhera-monitor; mvn -U clean package --fail-at-end -Dmaven.test.skip=true
6 changes: 3 additions & 3 deletions ozhera-monitor/dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM openjdk:8-jre
FROM openjdk:21-jdk-bookworm

COPY ./hera-monitor-server/target/hera-monitor-server-1.1-SNAPSHOT.jar /home/work/hera-monitor-server-1.1-SNAPSHOT.jar
COPY ./ozhera-monitor-server/target/ozhera-monitor-server-1.2-jdk21-SNAPSHOT.jar /home/work/ozhera-monitor-server-1.2-jdk21-SNAPSHOT.jar

ENTRYPOINT ["java","-XX:+PrintReferenceGC","-XX:+PrintGCDetails","-XX:+PrintGCDateStamps","-XX:+PrintHeapAtGC","-Xloggc:/home/work/log/gc.log","-Duser.timezone=Asia/Shanghai","-XX:+HeapDumpOnOutOfMemoryError","-XX:HeapDumpPath=/home/rocksdb/dum/oom.dump","-jar","/home/work/hera-monitor-server-1.1-SNAPSHOT.jar","&&","tail","-f","/dev/null"]
ENTRYPOINT ["sh","-c","java -XX:+UseZGC --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.math=ALL-UNNAMED --add-opens java.base/sun.reflect=ALL-UNNAMED --add-opens java.base/java.xml=ALL-UNNAMED --add-exports java.base/sun.reflect.annotation=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED --add-exports java.xml/com.sun.org.apache.xerces.internal.impl.dv.util=ALL-UNNAMED -Duser.timezone=Asia/Shanghai -jar /home/work/ozhera-monitor-server-1.2-jdk21-SNAPSHOT.jar"]
8 changes: 1 addition & 7 deletions ozhera-monitor/ozhera-monitor-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,16 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-monitor</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.2-jdk21-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ozhera-monitor-api</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>

<dependency>
Expand Down
8 changes: 1 addition & 7 deletions ozhera-monitor/ozhera-monitor-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-monitor</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.2-jdk21-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ozhera-monitor-common</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
Expand Down Expand Up @@ -45,7 +40,6 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
</dependency>

</dependencies>
Expand Down
13 changes: 7 additions & 6 deletions ozhera-monitor/ozhera-monitor-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,22 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-monitor</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.2-jdk21-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ozhera-monitor-server</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>run.mone</groupId>
<artifactId>ozhera-monitor-service</artifactId>
<exclusions>
<exclusion>
<artifactId>spring-context-support</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ public void operationLog(){}
@Resource(name = "heraRequestMappingExecutor")
private ThreadPoolExecutor heraRequestMappingExecutor;

@Bean("heraRequestMappingExecutor")
public ThreadPoolExecutor heraRequestMappingExecutor() {
return new ThreadPoolExecutor(1, 20, 5, TimeUnit.MINUTES, new LinkedBlockingQueue(20),
(Runnable r) -> new Thread(r, "compute-execute-thread-v2"), new ThreadPoolExecutor.CallerRunsPolicy());
}

@Around("operationLog()")
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.xiaomi.mone.monitor.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Configuration
public class BeanConfiguration {

@Bean("heraRequestMappingExecutor")
public ThreadPoolExecutor heraRequestMappingExecutor() {
return new ThreadPoolExecutor(1, 20, 5, TimeUnit.MINUTES, new LinkedBlockingQueue(20),
(Runnable r) -> new Thread(r, "compute-execute-thread-v2"), new ThreadPoolExecutor.CallerRunsPolicy());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ [email protected]@
dev.mode=@dev.mode@
inner.auth=@inner.auth@

service.selector.property=@service.selector.property@
service.selector.property=@service.selector.property@
spring.main.allow-circular-references=true
21 changes: 5 additions & 16 deletions ozhera-monitor/ozhera-monitor-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
<parent>
<groupId>run.mone</groupId>
<artifactId>ozhera-monitor</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.2-jdk21-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>ozhera-monitor-service</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>

<dependency>
Expand All @@ -33,7 +28,7 @@
<dependency>
<groupId>run.mone</groupId>
<artifactId>app-api</artifactId>
<version>1.4-SNAPSHOT</version>
<version>1.4-jdk21-SNAPSHOT</version>
</dependency>

<dependency>
Expand All @@ -60,9 +55,9 @@
</dependency>

<dependency>
<groupId>run.mone</groupId>
<groupId>com.alibaba.spring</groupId>
<artifactId>spring-context-support</artifactId>
<version>1.0.10-mone-SNAPSHOT</version>
<version>1.0.10</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -189,7 +184,7 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.0.6.RELEASE</version>
<version>5.3.29</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -261,12 +256,6 @@
<version>3.14.2</version>
</dependency>

<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.17.2</version>
</dependency>

<dependency>
<groupId>run.mone</groupId>
<artifactId>http</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.core.CountRequest;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.query.*;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
Expand Down
37 changes: 20 additions & 17 deletions ozhera-monitor/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.2</version>
<version>2.7.15</version>
</parent>

<groupId>run.mone</groupId>
<artifactId>ozhera-monitor</artifactId>
<packaging>pom</packaging>
<version>1.2-SNAPSHOT</version>
<version>1.2-jdk21-SNAPSHOT</version>
<modules>
<module>ozhera-monitor-server</module>
<module>ozhera-monitor-service</module>
Expand All @@ -22,11 +22,10 @@
</modules>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>5.1.3.RELEASE</spring.version>
<ozhera-monitor.release.version>1.2-SNAPSHOT</ozhera-monitor.release.version>
<spring.version>5.3.29</spring.version>
<lombok.version>1.18.30</lombok.version>
<ozhera-monitor.release.version>1.2-jdk21-SNAPSHOT</ozhera-monitor.release.version>
<!-- Replace it with the absolute path of your own hera-monitor project. -->
<maven.jcommonDirectory>/opt/workspace_all/workspace_mi/mone_opensource/ozhera/ozhera-monitor</maven.jcommonDirectory>
</properties>
Expand Down Expand Up @@ -86,28 +85,32 @@
<version>${ozhera-monitor.release.version}</version>
</dependency>
<!-- inner-module -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>


<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>4.9.3</version>
</dependency>
</dependencies>


</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<fork>true</fork>
<verbose>true</verbose>
<encoding>UTF-8</encoding>
<compilerArguments>
<sourcepath>
${project.basedir}/src/main/java
</sourcepath>
</compilerArguments>
<compilerVersion>21</compilerVersion>
<source>21</source>
<target>21</target>
</configuration>
</plugin>

Expand Down

0 comments on commit 197e03a

Please sign in to comment.