Merge branch 'apache-3.2' into apache-3.3

# Conflicts:
#	dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
#	dubbo-dependencies-bom/pom.xml
#	dubbo-native-plugin/pom.xml
#	dubbo-spring-boot/pom.xml
This commit is contained in:
Albumen Kevin 2024-06-17 10:00:57 +08:00
commit 5985116582
19 changed files with 84 additions and 45 deletions

View File

@ -16,6 +16,7 @@
*/
package org.apache.dubbo.common;
import org.apache.dubbo.common.constants.CommonConstants;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.utils.StringUtils;
@ -84,7 +85,8 @@ public final class Version {
}
private static void tryLoadVersionFromResource() throws IOException {
Enumeration<URL> configLoader = Version.class.getClassLoader().getResources("META-INF/versions/dubbo-common");
Enumeration<URL> configLoader =
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + "/dubbo-common");
if (configLoader.hasMoreElements()) {
URL url = configLoader.nextElement();
try (BufferedReader reader =
@ -312,7 +314,7 @@ public final class Version {
private static void checkArtifact(String artifactId) throws IOException {
Enumeration<URL> artifactEnumeration =
Version.class.getClassLoader().getResources("META-INF/versions/" + artifactId);
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + artifactId);
while (artifactEnumeration.hasMoreElements()) {
URL url = artifactEnumeration.nextElement();
try (BufferedReader reader =
@ -348,7 +350,7 @@ public final class Version {
private static Set<String> loadArtifactIds() throws IOException {
Enumeration<URL> artifactsEnumeration =
Version.class.getClassLoader().getResources("META-INF/versions/.artifacts");
Version.class.getClassLoader().getResources(CommonConstants.DUBBO_VERSIONS_KEY + "/.artifacts");
Set<String> artifactIds = new HashSet<>();
while (artifactsEnumeration.hasMoreElements()) {
URL url = artifactsEnumeration.nextElement();

View File

@ -24,6 +24,7 @@ import java.util.concurrent.ExecutorService;
import java.util.regex.Pattern;
public interface CommonConstants {
String DUBBO = "dubbo";
String TRIPLE = "tri";
@ -263,12 +264,14 @@ public interface CommonConstants {
String $INVOKE = "$invoke";
String $INVOKE_ASYNC = "$invokeAsync";
String GENERIC_PARAMETER_DESC = "Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Object;";
/**
* echo call
*/
String $ECHO = "$echo";
/**
* package version in the manifest
*/
@ -279,13 +282,21 @@ public interface CommonConstants {
int MAX_PROXY_COUNT = 65535;
String MONITOR_KEY = "monitor";
String BACKGROUND_KEY = "background";
String CLUSTER_KEY = "cluster";
String MERGEABLE_CLUSTER_NAME = "mergeable";
String USERNAME_KEY = "username";
String PASSWORD_KEY = "password";
String HOST_KEY = "host";
String PORT_KEY = "port";
String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND";
/**
@ -297,21 +308,29 @@ public interface CommonConstants {
String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds";
String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait";
String DUBBO_PROTOCOL = "dubbo";
String DUBBO_LABELS = "dubbo.labels";
String DUBBO_ENV_KEYS = "dubbo.env.keys";
String CONFIG_CONFIGFILE_KEY = "config-file";
String CONFIG_ENABLE_KEY = "highest-priority";
String CONFIG_NAMESPACE_KEY = "namespace";
String CHECK_KEY = "check";
String BACKLOG_KEY = "backlog";
String HEARTBEAT_EVENT = null;
String MOCK_HEARTBEAT_EVENT = "H";
String READONLY_EVENT = "R";
String WRITEABLE_EVENT = "W";
String REFERENCE_FILTER_KEY = "reference.filter";
@ -442,6 +461,7 @@ public interface CommonConstants {
String REGISTRY_DELAY_NOTIFICATION_KEY = "delay-notification";
String CACHE_CLEAR_TASK_INTERVAL = "dubbo.application.url.cache.task.interval";
String CACHE_CLEAR_WAITING_THRESHOLD = "dubbo.application.url.cache.clear.waiting";
String CLUSTER_INTERCEPTOR_COMPATIBLE_KEY = "dubbo.application.cluster.interceptor.compatible";
@ -575,10 +595,18 @@ public interface CommonConstants {
String SERVICE_EXECUTOR = "service-executor";
String EXECUTOR_MANAGEMENT_MODE = "executor-management-mode";
String EXECUTOR_MANAGEMENT_MODE_DEFAULT = "default";
String EXECUTOR_MANAGEMENT_MODE_ISOLATION = "isolation";
/**
* used in JVMUtil.java ,Control stack print lines, default is 32 lines
*/
String DUBBO_JSTACK_MAXLINE = "dubbo.jstack-dump.max-line";
String ENCODE_IN_IO_THREAD_KEY = "encode.in.io";
boolean DEFAULT_ENCODE_IN_IO_THREAD = false;
String PAYLOAD = "payload";
@ -603,6 +631,10 @@ public interface CommonConstants {
String IS_EXTRA = "isExtra";
String ZOOKEEPER_ENSEMBLE_TRACKER_KEY = "zookeeper.ensemble.tracker";
String DUBBO_VERSIONS_KEY = "META-INF/dubbo-versions";
/**
* System-related VM properties
*/
@ -687,16 +719,16 @@ public interface CommonConstants {
String DUBBO_JSTACK_MAXLINE = "dubbo.jstack-dump.max-line";
/**
* The property name for {@link NetworkInterface#getDisplayName() the name of network interface} that
* the Dubbo application will be ignored
* The property name for {@link NetworkInterface#getDisplayName() the name of network interface} that the Dubbo
* application will be ignored
*
* @since 2.7.6
*/
String DUBBO_NETWORK_IGNORED_INTERFACE = "dubbo.network.interface.ignored";
/**
* The property name for {@link NetworkInterface#getDisplayName() the name of network interface} that
* the Dubbo application prefers
* The property name for {@link NetworkInterface#getDisplayName() the name of network interface} that the Dubbo
* application prefers
*
* @since 2.7.6
*/

View File

@ -190,7 +190,6 @@ org.thymeleaf.
org.yaml.snakeyaml.tokens.
pstore.shaded.org.apache.commons.collections.
sun.print.
sun.rmi.server.
sun.rmi.transport.
sun.rmi.
weblogic.ejb20.internal.
weblogic.jms.common.

View File

@ -17,6 +17,7 @@
package org.apache.dubbo.common.version;
import org.apache.dubbo.common.Version;
import org.apache.dubbo.common.constants.CommonConstants;
import java.io.FileInputStream;
import java.io.IOException;
@ -110,7 +111,7 @@ class VersionTest {
ClassLoader classLoader = new ClassLoader(originClassLoader) {
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (name.equals("org.apache.dubbo.common.Version")) {
if ("org.apache.dubbo.common.Version".equals(name)) {
return findClass(name);
}
return super.loadClass(name);
@ -145,15 +146,13 @@ class VersionTest {
@Override
public Enumeration<URL> getResources(String name) throws IOException {
if (name.equals("META-INF/versions/dubbo-common")) {
if (name.equals(CommonConstants.DUBBO_VERSIONS_KEY + "/dubbo-common")) {
return super.getResources("META-INF/test-versions/dubbo-common");
}
return super.getResources(name);
}
};
Class<?> versionClass = classLoader.loadClass("org.apache.dubbo.common.Version");
return versionClass;
return classLoader.loadClass("org.apache.dubbo.common.Version");
}
@Test

View File

@ -93,14 +93,14 @@
<spring_version>5.3.36</spring_version>
<spring_security_version>5.8.12</spring_security_version>
<javassist_version>3.30.2-GA</javassist_version>
<byte-buddy_version>1.14.16</byte-buddy_version>
<byte-buddy_version>1.14.17</byte-buddy_version>
<netty_version>3.2.10.Final</netty_version>
<netty4_version>4.1.110.Final</netty4_version>
<netty_http3_version>0.0.28.Final</netty_http3_version>
<httpclient_version>4.5.14</httpclient_version>
<httpcore_version>4.4.16</httpcore_version>
<fastjson_version>1.2.83</fastjson_version>
<fastjson2_version>2.0.49</fastjson2_version>
<fastjson2_version>2.0.51</fastjson2_version>
<zookeeper_version>3.7.2</zookeeper_version>
<curator_version>5.1.0</curator_version>
<curator_test_version>2.12.0</curator_test_version>
@ -124,7 +124,7 @@
<micrometer.version>1.13.0</micrometer.version>
<opentelemetry.version>1.26.0</opentelemetry.version>
<zipkin-reporter.version>2.16.4</zipkin-reporter.version>
<micrometer-tracing.version>1.2.5</micrometer-tracing.version>
<micrometer-tracing.version>1.3.0</micrometer-tracing.version>
<t_digest.version>3.3</t_digest.version>
<prometheus_client.version>0.16.0</prometheus_client.version>
<reactive.version>1.0.4</reactive.version>

View File

@ -49,14 +49,14 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.13.0</version>
<version>3.13.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
<version>3.3.2</version>
<version>3.4.0</version>
</dependency>
<dependency>
@ -104,7 +104,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.13.0</version>
<version>3.13.1</version>
<configuration>
<goalPrefix>dubbo</goalPrefix>
</configuration>

View File

@ -47,13 +47,11 @@ public final class ReactorServerCalls {
public static <T, R> void oneToOne(T request, StreamObserver<R> responseObserver, Function<Mono<T>, Mono<R>> func) {
try {
func.apply(Mono.just(request))
.switchIfEmpty(Mono.error(TriRpcStatus.NOT_FOUND.asException()))
.subscribe(
res -> {
responseObserver.onNext(res);
responseObserver.onCompleted();
},
responseObserver::onNext,
throwable -> doOnResponseHasException(throwable, responseObserver),
() -> doOnResponseHasException(TriRpcStatus.NOT_FOUND.asException(), responseObserver));
responseObserver::onCompleted);
} catch (Throwable throwable) {
doOnResponseHasException(throwable, responseObserver);
}

View File

@ -43,6 +43,7 @@ import org.apache.zookeeper.data.ACL;
import static org.apache.curator.x.discovery.ServiceInstance.builder;
import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
import static org.apache.dubbo.common.constants.CommonConstants.ZOOKEEPER_ENSEMBLE_TRACKER_KEY;
import static org.apache.dubbo.registry.zookeeper.ZookeeperServiceDiscovery.DEFAULT_GROUP;
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkParams.BASE_SLEEP_TIME;
import static org.apache.dubbo.registry.zookeeper.util.CuratorFrameworkParams.BLOCK_UNTIL_CONNECTED_UNIT;
@ -69,8 +70,10 @@ public abstract class CuratorFrameworkUtils {
public static CuratorFramework buildCuratorFramework(URL connectionURL, ZookeeperServiceDiscovery serviceDiscovery)
throws Exception {
boolean ensembleTracker = connectionURL.getParameter(ZOOKEEPER_ENSEMBLE_TRACKER_KEY, true);
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString(connectionURL.getBackupAddress())
.ensembleTracker(ensembleTracker)
.retryPolicy(buildRetryPolicy(connectionURL));
String userInformation = connectionURL.getUserInformation();
if (StringUtils.isNotEmpty(userInformation)) {

View File

@ -40,6 +40,7 @@ public abstract class AbstractZookeeperClient<TargetDataListener, TargetChildLis
// may hang up to wait name resolution up to 10s
protected int DEFAULT_CONNECTION_TIMEOUT_MS = 30 * 1000;
protected int DEFAULT_SESSION_TIMEOUT_MS = 60 * 1000;
protected boolean DEFAULT_ENSEMBLE_TRACKER = true;
private final URL url;

View File

@ -50,6 +50,7 @@ import org.apache.zookeeper.data.Stat;
import static org.apache.dubbo.common.constants.CommonConstants.SESSION_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.ZOOKEEPER_ENSEMBLE_TRACKER_KEY;
import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_CONNECT_REGISTRY;
import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_ZOOKEEPER_EXCEPTION;
@ -69,10 +70,12 @@ public class Curator5ZookeeperClient
try {
int timeout = url.getParameter(TIMEOUT_KEY, DEFAULT_CONNECTION_TIMEOUT_MS);
int sessionExpireMs = url.getParameter(SESSION_KEY, DEFAULT_SESSION_TIMEOUT_MS);
boolean ensembleTracker = url.getParameter(ZOOKEEPER_ENSEMBLE_TRACKER_KEY, DEFAULT_ENSEMBLE_TRACKER);
CuratorFrameworkFactory.Builder builder = CuratorFrameworkFactory.builder()
.connectString(url.getBackupAddress())
.retryPolicy(new RetryNTimes(1, 1000))
.connectionTimeoutMs(timeout)
.ensembleTracker(ensembleTracker)
.sessionTimeoutMs(sessionExpireMs);
String userInformation = url.getUserInformation();
if (userInformation != null && userInformation.length() > 0) {

View File

@ -108,7 +108,7 @@ public class AccessLogFilter implements Filter {
public Result invoke(Invoker<?> invoker, Invocation inv) throws RpcException {
String accessLogKey = invoker.getUrl().getParameter(Constants.ACCESS_LOG_KEY);
boolean isFixedPath = invoker.getUrl().getParameter(ACCESS_LOG_FIXED_PATH_KEY, true);
if (StringUtils.isEmpty(accessLogKey)) {
if (StringUtils.isEmpty(accessLogKey) || "false".equalsIgnoreCase(accessLogKey)) {
// Notice that disable accesslog of one service may cause the whole application to stop collecting
// accesslog.
// It's recommended to use application level configuration to enable or disable accesslog if dynamically

View File

@ -25,11 +25,11 @@ import java.util.zip.GZIPOutputStream;
import org.springframework.http.HttpHeaders;
import org.springframework.util.unit.DataSize;
import zipkin2.Call;
import zipkin2.CheckResult;
import zipkin2.codec.Encoding;
import zipkin2.reporter.BytesMessageEncoder;
import zipkin2.reporter.Call;
import zipkin2.reporter.CheckResult;
import zipkin2.reporter.ClosedSenderException;
import zipkin2.reporter.Encoding;
import zipkin2.reporter.Sender;
/**

View File

@ -134,7 +134,7 @@ class ZipkinConfigurations {
@ConditionalOnMissingBean
@ConditionalOnBean(Sender.class)
AsyncReporter<Span> spanReporter(Sender sender, BytesEncoder<Span> encoder) {
return AsyncReporter.builder(sender).build(encoder);
return AsyncReporter.builder(sender).build((zipkin2.reporter.BytesEncoder<Span>) encoder);
}
}

View File

@ -19,8 +19,8 @@ package org.apache.dubbo.spring.boot.observability.autoconfigure.exporter.zipkin
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.web.client.RestTemplate;
import zipkin2.Call;
import zipkin2.Callback;
import zipkin2.reporter.Call;
import zipkin2.reporter.Callback;
class ZipkinRestTemplateSender extends HttpSender {
private final String endpoint;

View File

@ -20,8 +20,8 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
import zipkin2.Call;
import zipkin2.Callback;
import zipkin2.reporter.Call;
import zipkin2.reporter.Callback;
class ZipkinWebClientSender extends HttpSender {
private final String endpoint;

View File

@ -37,9 +37,9 @@
<properties>
<micrometer.version>1.13.0</micrometer.version>
<micrometer-tracing.version>1.2.5</micrometer-tracing.version>
<opentelemetry.version>1.34.1</opentelemetry.version>
<zipkin-reporter.version>2.17.2</zipkin-reporter.version>
<micrometer-tracing.version>1.3.0</micrometer-tracing.version>
<opentelemetry.version>1.39.0</opentelemetry.version>
<zipkin-reporter.version>3.4.0</zipkin-reporter.version>
<prometheus-client.version>0.16.0</prometheus-client.version>
</properties>

View File

@ -42,7 +42,7 @@
<properties>
<spring-boot.version>2.7.18</spring-boot.version>
<!-- Spring boot buddy is lower than the delivery dependency package version and can only show the defined dependency version -->
<byte-buddy.version>1.14.15</byte-buddy.version>
<byte-buddy.version>1.14.17</byte-buddy.version>
<mockito_version>4.11.0</mockito_version>
</properties>

View File

@ -16,6 +16,8 @@
*/
package org.apache.dubbo.dependency;
import org.apache.dubbo.common.constants.CommonConstants;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@ -139,7 +141,7 @@ class FileTest {
List<String> artifactIdsInRoot = IOUtils.readLines(
this.getClass()
.getClassLoader()
.getResource("META-INF/versions/.artifacts")
.getResource(CommonConstants.DUBBO_VERSIONS_KEY + "/.artifacts")
.openStream(),
StandardCharsets.UTF_8);
artifactIdsInRoot.removeIf(s -> s.startsWith("#"));

12
pom.xml
View File

@ -135,12 +135,12 @@
<maven_deploy_version>2.8.2</maven_deploy_version>
<maven_compiler_version>3.13.0</maven_compiler_version>
<maven_source_version>3.3.1</maven_source_version>
<maven_javadoc_version>3.6.3</maven_javadoc_version>
<maven_javadoc_version>3.7.0</maven_javadoc_version>
<maven_jetty_version>9.4.54.v20240208</maven_jetty_version>
<maven_checkstyle_version>3.3.1</maven_checkstyle_version>
<maven_checkstyle_version>3.4.0</maven_checkstyle_version>
<maven_jacoco_version>0.8.12</maven_jacoco_version>
<maven_flatten_version>1.6.0</maven_flatten_version>
<maven_enforce_version>3.4.1</maven_enforce_version>
<maven_enforce_version>3.5.0</maven_enforce_version>
<maven_antrun_version>3.1.0</maven_antrun_version>
<maven_os_plugin_version>1.7.1</maven_os_plugin_version>
<maven_protobuf_plugin_version>0.6.1</maven_protobuf_plugin_version>
@ -218,7 +218,7 @@
</includes>
</resource>
<resource>
<targetPath>META-INF/versions</targetPath>
<targetPath>META-INF/dubbo-versions</targetPath>
<filtering>false</filtering>
<directory>${maven.multiModuleProjectDirectory}</directory>
<includes>
@ -280,7 +280,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<version>3.6.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
@ -392,7 +392,7 @@
<configuration>
<failOnError>true</failOnError>
<target>
<property name="version_file" value="${project.build.outputDirectory}/META-INF/versions/${project.artifactId}" />
<property name="version_file" value="${project.build.outputDirectory}/META-INF/dubbo-versions/${project.artifactId}" />
<!-- get the current version of dubbo -->
<echo file="${version_file}" message="revision=${revision}${line.separator}" />
<!-- attach the artifact id -->