Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/jdk21 #357

Merged
merged 10 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/workflows/docker-image-tomcat.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/maven-extension-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '21'
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven-web-api-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '11'
java-version: '21'
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 8, 11 ]
java-version: [ 21 ]
steps:
- uses: actions/checkout@v3
- name: "Test for JDK ${{ matrix.java-version }}"
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM maven:3-openjdk-8-slim as builder
FROM maven:3.9.9-eclipse-temurin-21 as builder
COPY . /usr/src/app/
WORKDIR /usr/src/app/
# buildkit support since docker 18.03
RUN --mount=type=cache,target=/root/.m2 mvn clean package -DskipTests -Pjar
# use this if you are on docker<=18.02
# RUN mvn clean package -DskipTests -Pjar

FROM eclipse-temurin:8-jre
FROM eclipse-temurin:21-jre
COPY --from=builder /usr/src/app/arex-schedule-jar/schedule.jar app.jar
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} -jar /app.jar"]
ENTRYPOINT ["sh", "-c", "java --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED ${JAVA_OPTS} -jar /app.jar"]
13 changes: 0 additions & 13 deletions Dockerfile-Tomcat

This file was deleted.

4 changes: 0 additions & 4 deletions arex-schedule-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,6 @@
<build>
<finalName>arex-schedule-web-api</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.arextest.schedule;

import com.arextest.common.metrics.PrometheusConfiguration;
import jakarta.annotation.PostConstruct;
import java.awt.Desktop;
import java.net.URI;
import javax.annotation.PostConstruct;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.arextest.schedule.aspect;

import com.arextest.common.annotation.AppAuth;
import javax.annotation.Resource;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
import com.arextest.config.model.dao.config.SystemConfigurationCollection;
import com.arextest.config.model.dao.config.SystemConfigurationCollection.KeySummary;
import com.arextest.schedule.dao.mongodb.ApplicationRepository;
import jakarta.servlet.http.HttpServletRequest;
import java.util.Optional;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.arextest.schedule.beans;

import jakarta.servlet.Filter;
import jakarta.servlet.FilterChain;
import jakarta.servlet.FilterConfig;
import jakarta.servlet.ServletException;
import jakarta.servlet.ServletRequest;
import jakarta.servlet.ServletResponse;
import jakarta.servlet.annotation.WebFilter;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* @author wyc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public RedisTemplate<byte[], byte[]> redisTemplate(
@Bean
@ConditionalOnExpression("'${arex.redis.uri:}'.isEmpty() and '${arex.redis.sentinelUrl:}'.isEmpty()")
@ConditionalOnMissingBean(CacheProvider.class)
public CacheProvider redisCacheProvider(RedisTemplate redisTemplate,
public CacheProvider redisCacheProvider(RedisTemplate<byte[], byte[]> redisTemplate,
RedissonClient redissonClient) {
return new RedisTemplateCacheProvider(redisTemplate, redissonClient);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.arextest.schedule.beans;

import com.arextest.schedule.common.ClassLoaderUtils;
import com.arextest.common.model.classloader.RemoteJarClassLoader;
import com.arextest.common.utils.RemoteJarLoaderUtils;
import com.arextest.schedule.extension.invoker.ReplayExtensionInvoker;
import com.arextest.schedule.sender.ReplaySender;
import com.arextest.schedule.sender.ReplaySenderFactory;
Expand All @@ -13,10 +14,11 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ServiceLoader;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -36,11 +38,9 @@ public class ReplaySenderConfiguration {
private static final String NEW_INVOKER_PATH = "dubboInvoker.jar";
private static final List<String> remoteProtocol = Arrays.asList("http", "https", "ftp", "sftp", "nfs");

@Bean("replayExtensionInvoker")
@Bean("dubboInvokerLoader")
@ConditionalOnProperty(name = "replay.sender.extension.switch", havingValue = "true")
public List<ReplayExtensionInvoker> invokers() {
List<ReplayExtensionInvoker> invokers = new ArrayList<>();

public RemoteJarClassLoader dubboInvokerLoader() {
try {
URL classPathResource;
if (StringUtils.isNotBlank(jarFilePath)) {
Expand All @@ -52,11 +52,21 @@ public List<ReplayExtensionInvoker> invokers() {
} else {
classPathResource = loadLocalInvokerJar();
}
ClassLoaderUtils.loadJar(classPathResource);
ServiceLoader.load(ReplayExtensionInvoker.class).forEach(invokers::add);
return RemoteJarLoaderUtils.loadJar(classPathResource.getPath());
} catch (Throwable t) {
LOGGER.error("Load invoker jar failed, application startup blocked", t);
}
LOGGER.error("No invoker found, application startup blocked");
throw new RuntimeException("No invoker found");
}

@Bean("replayExtensionInvoker")
@ConditionalOnBean(name = "dubboInvokerLoader")
public List<ReplayExtensionInvoker> invokers(
@Qualifier("dubboInvokerLoader") RemoteJarClassLoader loader) {
List<ReplayExtensionInvoker> invokers = new ArrayList<>(
RemoteJarLoaderUtils.loadService(ReplayExtensionInvoker.class, loader));

if (invokers.isEmpty()) {
LOGGER.error("No invoker found, application startup blocked");
throw new RuntimeException("No invoker found");
Expand All @@ -66,12 +76,13 @@ public List<ReplayExtensionInvoker> invokers() {
}

@Bean
@ConditionalOnProperty(name = "replay.sender.extension.switch", havingValue = "true")
@ConditionalOnBean(name = "replayExtensionInvoker")
public DefaultDubboReplaySender dubboReplaySender(
@Value("#{'${arex.replay.header.excludes.dubbo}'.split(',')}") List<String> excludes,
List<ReplayExtensionInvoker> invokers) {
List<ReplayExtensionInvoker> invokers,
@Qualifier("dubboInvokerLoader") RemoteJarClassLoader loader) {

return new DefaultDubboReplaySender(excludes, invokers);
return new DefaultDubboReplaySender(excludes, invokers, loader);
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
import com.arextest.schedule.utils.SSLUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Maps;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.HttpStatusCode;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
Expand Down Expand Up @@ -35,7 +35,7 @@ public ClientHttpResponse intercept(HttpRequest request, byte[] body,
throw ex;
}

HttpStatus statusCode = response.getStatusCode();
HttpStatusCode statusCode = response.getStatusCode();

// Log the failed request if the response status code is 4xx or 5xx
if (statusCode.is4xxClientError() || statusCode.is5xxServerError()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


import com.arextest.schedule.serialization.ZstdJacksonSerializer;
import jakarta.annotation.Resource;
import java.io.IOException;
import javax.annotation.Resource;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
import com.arextest.schedule.progress.ProgressEvent;
import com.arextest.web.model.contract.contracts.config.SystemConfigWithProperties;
import com.arextest.web.model.contract.contracts.config.replay.ReplayCompareConfig;
import jakarta.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
Expand Down
Loading
Loading