Compare commits

..

No commits in common. "3.2" and "dubbo-3.2.13" have entirely different histories.

41 changed files with 91 additions and 265 deletions

View File

@ -43,7 +43,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 21
java-version: 8
- uses: actions/cache@v3
name: "Cache local Maven repository"
with:

View File

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

View File

@ -24,7 +24,6 @@ import java.util.concurrent.ExecutorService;
import java.util.regex.Pattern;
public interface CommonConstants {
String DUBBO = "dubbo";
String TRIPLE = "tri";
@ -268,14 +267,12 @@ 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
*/
@ -286,19 +283,12 @@ public interface CommonConstants {
int MAX_PROXY_COUNT = 65535;
String MONITOR_KEY = "monitor";
String BACKGROUND_KEY = "background";
String CLUSTER_KEY = "cluster";
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";
/**
@ -318,29 +308,21 @@ 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";
@ -477,7 +459,6 @@ 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";
@ -634,18 +615,17 @@ 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;
/**
@ -666,8 +646,4 @@ public interface CommonConstants {
String DUBBO_MANUAL_REGISTER_KEY = "dubbo.application.manual-register";
String DUBBO2_COMPACT_ENABLE = "dubbo.compact.enable";
String ZOOKEEPER_ENSEMBLE_TRACKER_KEY = "zookeeper.ensemble.tracker";
String DUBBO_VERSIONS_KEY = "META-INF/dubbo-versions";
}

View File

@ -34,6 +34,4 @@ public interface DataStore {
void put(String componentName, String key, Object value);
void remove(String componentName, String key);
default void addListener(DataStoreUpdateListener dataStoreUpdateListener) {}
}

View File

@ -1,21 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dubbo.common.store;
public interface DataStoreUpdateListener {
void onUpdate(String componentName, String key, Object value);
}

View File

@ -16,13 +16,8 @@
*/
package org.apache.dubbo.common.store.support;
import org.apache.dubbo.common.constants.LoggerCodeConstants;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.store.DataStore;
import org.apache.dubbo.common.store.DataStoreUpdateListener;
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
import org.apache.dubbo.common.utils.ConcurrentHashSet;
import java.util.HashMap;
import java.util.Map;
@ -30,11 +25,9 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
public class SimpleDataStore implements DataStore {
private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SimpleDataStore.class);
// <component name or id, <data-name, data-value>>
private final ConcurrentMap<String, ConcurrentMap<String, Object>> data = new ConcurrentHashMap<>();
private final ConcurrentHashSet<DataStoreUpdateListener> listeners = new ConcurrentHashSet<>();
@Override
public Map<String, Object> get(String componentName) {
@ -59,7 +52,6 @@ public class SimpleDataStore implements DataStore {
Map<String, Object> componentData =
ConcurrentHashMapUtils.computeIfAbsent(data, componentName, k -> new ConcurrentHashMap<>());
componentData.put(key, value);
notifyListeners(componentName, key, value);
}
@Override
@ -68,27 +60,5 @@ public class SimpleDataStore implements DataStore {
return;
}
data.get(componentName).remove(key);
notifyListeners(componentName, key, null);
}
@Override
public void addListener(DataStoreUpdateListener dataStoreUpdateListener) {
listeners.add(dataStoreUpdateListener);
}
private void notifyListeners(String componentName, String key, Object value) {
for (DataStoreUpdateListener listener : listeners) {
try {
listener.onUpdate(componentName, key, value);
} catch (Throwable t) {
logger.warn(
LoggerCodeConstants.INTERNAL_ERROR,
"",
"",
"Failed to notify data store update listener. " + "ComponentName: " + componentName + " Key: "
+ key,
t);
}
}
}
}

View File

@ -149,11 +149,7 @@ public interface Constants {
String SERVER_THREAD_POOL_NAME = "DubboServerHandler";
String SERVER_THREAD_POOL_PREFIX = SERVER_THREAD_POOL_NAME + "-";
String CLIENT_THREAD_POOL_NAME = "DubboClientHandler";
String CLIENT_THREAD_POOL_PREFIX = CLIENT_THREAD_POOL_NAME + "-";
String REST_PROTOCOL = "rest";
}

View File

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

View File

@ -16,13 +16,9 @@
*/
package org.apache.dubbo.common.store.support;
import org.apache.dubbo.common.store.DataStoreUpdateListener;
import java.util.Map;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
@ -61,30 +57,4 @@ class SimpleDataStoreTest {
dataStore.remove("component", "key");
assertNotEquals(map, dataStore.get("component"));
}
@Test
void testNotify() {
DataStoreUpdateListener listener = Mockito.mock(DataStoreUpdateListener.class);
dataStore.addListener(listener);
ArgumentCaptor<String> componentNameCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<String> keyCaptor = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<Object> valueCaptor = ArgumentCaptor.forClass(Object.class);
dataStore.put("name", "key", "1");
Mockito.verify(listener).onUpdate(componentNameCaptor.capture(), keyCaptor.capture(), valueCaptor.capture());
assertEquals("name", componentNameCaptor.getValue());
assertEquals("key", keyCaptor.getValue());
assertEquals("1", valueCaptor.getValue());
dataStore.remove("name", "key");
Mockito.verify(listener, Mockito.times(2))
.onUpdate(componentNameCaptor.capture(), keyCaptor.capture(), valueCaptor.capture());
assertEquals("name", componentNameCaptor.getValue());
assertEquals("key", keyCaptor.getValue());
assertNull(valueCaptor.getValue());
dataStore.remove("name2", "key");
Mockito.verify(listener, Mockito.times(0)).onUpdate("name2", "key", null);
}
}

View File

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

View File

@ -37,7 +37,7 @@
<skip_maven_deploy>true</skip_maven_deploy>
<spring-boot.version>2.7.18</spring-boot.version>
<spring-boot-maven-plugin.version>2.7.18</spring-boot-maven-plugin.version>
<micrometer-core.version>1.13.1</micrometer-core.version>
<micrometer-core.version>1.13.0</micrometer-core.version>
</properties>
<dependencyManagement>
<dependencies>

View File

@ -90,16 +90,16 @@
<properties>
<!-- Common libs -->
<!-- <spring_version>4.3.30.RELEASE</spring_version> -->
<spring_version>5.3.37</spring_version>
<spring_security_version>5.8.13</spring_security_version>
<spring_version>5.3.35</spring_version>
<spring_security_version>5.8.12</spring_security_version>
<javassist_version>3.30.2-GA</javassist_version>
<bytebuddy.version>1.14.17</bytebuddy.version>
<bytebuddy.version>1.14.15</bytebuddy.version>
<netty_version>3.2.10.Final</netty_version>
<netty4_version>4.1.111.Final</netty4_version>
<netty4_version>4.1.109.Final</netty4_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.51</fastjson2_version>
<fastjson2_version>2.0.49</fastjson2_version>
<zookeeper_version>3.7.0</zookeeper_version>
<curator_version>5.1.0</curator_version>
<curator_test_version>2.12.0</curator_test_version>
@ -109,7 +109,7 @@
<javax_annotation-api_version>1.3.2</javax_annotation-api_version>
<servlet_version>3.1.0</servlet_version>
<jetty_version>9.4.54.v20240208</jetty_version>
<validation_new_version>3.1.0</validation_new_version>
<validation_new_version>3.0.2</validation_new_version>
<validation_version>1.1.0.Final</validation_version>
<hibernate_validator_version>5.4.3.Final</hibernate_validator_version>
<hibernate_validator_new_version>7.0.5.Final</hibernate_validator_new_version>
@ -119,13 +119,13 @@
<snakeyaml_version>2.2</snakeyaml_version>
<commons_lang3_version>3.14.0</commons_lang3_version>
<envoy_api_version>0.1.35</envoy_api_version>
<micrometer.version>1.13.1</micrometer.version>
<micrometer.version>1.13.0</micrometer.version>
<micrometer-tracing.version>1.3.1</micrometer-tracing.version>
<micrometer-tracing.version>1.2.5</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>
<reactor.version>3.6.7</reactor.version>
<reactor.version>3.6.6</reactor.version>
<rxjava.version>2.2.21</rxjava.version>
<okhttp_version>3.14.9</okhttp_version>
@ -146,7 +146,7 @@
<log4j2_version>2.23.1</log4j2_version>
<commons_io_version>2.16.1</commons_io_version>
<embedded_redis_version>1.4.3</embedded_redis_version>
<embedded_redis_version>1.1.0</embedded_redis_version>
<!-- Alibaba -->
<alibaba_spring_context_support_version>1.0.11</alibaba_spring_context_support_version>
@ -165,12 +165,12 @@
<mortbay_jetty_version>6.1.26</mortbay_jetty_version>
<portlet_version>2.0</portlet_version>
<maven_flatten_version>1.6.0</maven_flatten_version>
<commons_compress_version>1.26.2</commons_compress_version>
<commons_compress_version>1.26.1</commons_compress_version>
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
<spotless.action>check</spotless.action>
<dubbo-shared-resources.version>1.0.0</dubbo-shared-resources.version>
<palantirJavaFormat.version>2.38.0</palantirJavaFormat.version>
<revision>3.2.15-SNAPSHOT</revision>
<revision>3.2.13</revision>
</properties>
<dependencyManagement>

View File

@ -31,7 +31,7 @@
<packaging>pom</packaging>
<properties>
<revision>3.2.15-SNAPSHOT</revision>
<revision>3.2.13</revision>
<maven_flatten_version>1.6.0</maven_flatten_version>
<curator5_version>5.1.0</curator5_version>
<zookeeper_version>3.8.4</zookeeper_version>

View File

@ -31,7 +31,7 @@
<packaging>pom</packaging>
<properties>
<revision>3.2.15-SNAPSHOT</revision>
<revision>3.2.13</revision>
<maven_flatten_version>1.6.0</maven_flatten_version>
<curator_version>4.3.0</curator_version>
<zookeeper_version>3.4.14</zookeeper_version>

View File

@ -33,27 +33,27 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.9.8</version>
<version>3.9.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.9.8</version>
<version>3.9.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.13.1</version>
<version>3.13.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-common-artifact-filters</artifactId>
<version>3.4.0</version>
<version>3.3.2</version>
</dependency>
<dependency>
@ -74,7 +74,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.13.1</version>
<version>3.13.0</version>
<configuration>
<goalPrefix>dubbo</goalPrefix>
</configuration>

View File

@ -18,8 +18,8 @@ package org.apache.dubbo.metrics.aggregate;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class TimeWindowAggregatorTest {
@Test

View File

@ -19,7 +19,6 @@ package org.apache.dubbo.metrics.collector.sample;
import org.apache.dubbo.common.logger.ErrorTypeAwareLogger;
import org.apache.dubbo.common.logger.LoggerFactory;
import org.apache.dubbo.common.store.DataStore;
import org.apache.dubbo.common.store.DataStoreUpdateListener;
import org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository;
import org.apache.dubbo.common.threadpool.support.AbortPolicyWithReport;
import org.apache.dubbo.common.utils.ConcurrentHashMapUtils;
@ -43,12 +42,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SHARED_EXECUTOR_SERVICE_COMPONENT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY;
import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_METRICS_COLLECTOR_EXCEPTION;
import static org.apache.dubbo.config.Constants.CLIENT_THREAD_POOL_PREFIX;
import static org.apache.dubbo.config.Constants.CLIENT_THREAD_POOL_NAME;
import static org.apache.dubbo.config.Constants.SERVER_THREAD_POOL_NAME;
import static org.apache.dubbo.config.Constants.SERVER_THREAD_POOL_PREFIX;
import static org.apache.dubbo.metrics.model.MetricsCategory.THREAD_POOL;
public class ThreadPoolMetricsSampler implements MetricsSampler, DataStoreUpdateListener {
public class ThreadPoolMetricsSampler implements MetricsSampler {
private final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(ThreadPoolMetricsSampler.class);
@ -63,28 +61,14 @@ public class ThreadPoolMetricsSampler implements MetricsSampler, DataStoreUpdate
this.collector = collector;
}
@Override
public void onUpdate(String componentName, String key, Object value) {
if (EXECUTOR_SERVICE_COMPONENT_KEY.equals(componentName)) {
if (value instanceof ThreadPoolExecutor) {
addExecutors(SERVER_THREAD_POOL_PREFIX + key, (ThreadPoolExecutor) value);
}
} else if (CONSUMER_SHARED_EXECUTOR_SERVICE_COMPONENT_KEY.equals(componentName)) {
if (value instanceof ThreadPoolExecutor) {
addExecutors(CLIENT_THREAD_POOL_PREFIX + key, (ThreadPoolExecutor) value);
}
}
}
public void addExecutors(String name, ExecutorService executorService) {
Optional.ofNullable(executorService)
.filter(Objects::nonNull)
.filter(e -> e instanceof ThreadPoolExecutor)
.map(e -> (ThreadPoolExecutor) e)
.ifPresent(threadPoolExecutor -> {
if (sampleThreadPoolExecutor.put(name, threadPoolExecutor) == null) {
samplesChanged.set(true);
}
sampleThreadPoolExecutor.put(name, threadPoolExecutor);
samplesChanged.set(true);
});
}
@ -168,20 +152,18 @@ public class ThreadPoolMetricsSampler implements MetricsSampler, DataStoreUpdate
}
if (dataStore != null) {
dataStore.addListener(this);
Map<String, Object> executors = dataStore.get(EXECUTOR_SERVICE_COMPONENT_KEY);
for (Map.Entry<String, Object> entry : executors.entrySet()) {
ExecutorService executor = (ExecutorService) entry.getValue();
if (executor instanceof ThreadPoolExecutor) {
this.addExecutors(SERVER_THREAD_POOL_PREFIX + entry.getKey(), executor);
this.addExecutors(SERVER_THREAD_POOL_NAME + "-" + entry.getKey(), executor);
}
}
executors = dataStore.get(CONSUMER_SHARED_EXECUTOR_SERVICE_COMPONENT_KEY);
for (Map.Entry<String, Object> entry : executors.entrySet()) {
ExecutorService executor = (ExecutorService) entry.getValue();
if (executor instanceof ThreadPoolExecutor) {
this.addExecutors(CLIENT_THREAD_POOL_PREFIX + entry.getKey(), executor);
this.addExecutors(CLIENT_THREAD_POOL_NAME + "-" + entry.getKey(), executor);
}
}

View File

@ -19,7 +19,6 @@ package org.apache.dubbo.metrics.collector.sample;
import org.apache.dubbo.common.beans.factory.ScopeBeanFactory;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.common.store.DataStore;
import org.apache.dubbo.common.store.DataStoreUpdateListener;
import org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository;
import org.apache.dubbo.metrics.collector.DefaultMetricsCollector;
import org.apache.dubbo.metrics.model.ThreadPoolMetric;
@ -38,13 +37,11 @@ import java.util.concurrent.ThreadPoolExecutor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SHARED_EXECUTOR_SERVICE_COMPONENT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.EXECUTOR_SERVICE_COMPONENT_KEY;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@SuppressWarnings("all")
@ -181,32 +178,4 @@ public class ThreadPoolMetricsSamplerTest {
serverExecutor.shutdown();
clientExecutor.shutdown();
}
@Test
void testDataSourceNotify() throws Exception {
ArgumentCaptor<DataStoreUpdateListener> captor = ArgumentCaptor.forClass(DataStoreUpdateListener.class);
when(scopeBeanFactory.getBean(FrameworkExecutorRepository.class)).thenReturn(frameworkExecutorRepository);
when(frameworkExecutorRepository.getSharedExecutor()).thenReturn(null);
sampler2.registryDefaultSampleThreadPoolExecutor();
Field f = ThreadPoolMetricsSampler.class.getDeclaredField("sampleThreadPoolExecutor");
f.setAccessible(true);
Map<String, ThreadPoolExecutor> executors = (Map<String, ThreadPoolExecutor>) f.get(sampler2);
Assertions.assertEquals(0, executors.size());
verify(dataStore).addListener(captor.capture());
Assertions.assertEquals(sampler2, captor.getValue());
ExecutorService executorService = Executors.newFixedThreadPool(5);
sampler2.onUpdate(EXECUTOR_SERVICE_COMPONENT_KEY, "20880", executorService);
executors = (Map<String, ThreadPoolExecutor>) f.get(sampler2);
Assertions.assertEquals(1, executors.size());
Assertions.assertTrue(executors.containsKey("DubboServerHandler-20880"));
sampler2.onUpdate(CONSUMER_SHARED_EXECUTOR_SERVICE_COMPONENT_KEY, "client", executorService);
Assertions.assertEquals(2, executors.size());
Assertions.assertTrue(executors.containsKey("DubboClientHandler-client"));
}
}

View File

@ -35,20 +35,20 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.9.8</version>
<version>3.9.6</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.9.8</version>
<version>3.9.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.13.1</version>
<version>3.13.0</version>
<scope>provided</scope>
</dependency>
@ -77,7 +77,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.13.1</version>
<version>3.13.0</version>
<configuration>
<goalPrefix>dubbo</goalPrefix>
</configuration>

View File

@ -48,11 +48,13 @@ 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(
responseObserver::onNext,
res -> {
responseObserver.onNext(res);
responseObserver.onCompleted();
},
throwable -> doOnResponseHasException(throwable, responseObserver),
responseObserver::onCompleted);
() -> doOnResponseHasException(TriRpcStatus.NOT_FOUND.asException(), responseObserver));
} catch (Throwable throwable) {
doOnResponseHasException(throwable, responseObserver);
}

View File

@ -43,7 +43,6 @@ 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;
@ -70,10 +69,8 @@ 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,7 +40,6 @@ 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

@ -55,7 +55,6 @@ 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;
@ -75,12 +74,10 @@ 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) || "false".equalsIgnoreCase(accessLogKey)) {
if (StringUtils.isEmpty(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

@ -36,7 +36,6 @@ import org.apache.dubbo.rpc.Result;
import org.apache.dubbo.rpc.RpcContext;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.RpcInvocation;
import org.apache.dubbo.rpc.model.ConsumerModel;
import org.apache.dubbo.rpc.model.MethodDescriptor;
import org.apache.dubbo.rpc.model.ServiceModel;
import org.apache.dubbo.rpc.protocol.AbstractInvoker;
@ -318,18 +317,11 @@ public class InjvmInvoker<T> extends AbstractInvoker<T> {
}
Object value = originValue;
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
// 1. By default, the classloader of the current Thread is the consumer class loader.
ClassLoader consumerClassLoader = contextClassLoader;
ServiceModel serviceModel = getUrl().getServiceModel();
// 2. If there is a ConsumerModel in the url, the classloader of the ConsumerModel is consumerLoader
if (Objects.nonNull(serviceModel) && serviceModel instanceof ConsumerModel) {
consumerClassLoader = serviceModel.getClassLoader();
}
// 3. request result copy
if (Objects.nonNull(consumerClassLoader)) {
Thread.currentThread().setContextClassLoader(consumerClassLoader);
ServiceModel consumerServiceModel = getUrl().getServiceModel();
if (consumerServiceModel != null) {
Thread.currentThread().setContextClassLoader(consumerServiceModel.getClassLoader());
Type[] returnTypes = RpcUtils.getReturnTypes(invocation);
if (returnTypes == null) {
return originValue;
@ -342,7 +334,7 @@ public class InjvmInvoker<T> extends AbstractInvoker<T> {
}
return value;
} finally {
Thread.currentThread().setContextClassLoader(contextClassLoader);
Thread.currentThread().setContextClassLoader(cl);
}
}

View File

@ -57,6 +57,7 @@ public class ProviderParseContext extends BaseParseContext {
public String getPathVariable(int urlSplitIndex) {
String[] split = getRequestFacade().getRequestURI().split("/");
return split[urlSplitIndex].split("\\?")[0];
return split[urlSplitIndex];
}
}

View File

@ -51,7 +51,7 @@ import static org.springframework.beans.factory.config.ConfigurableBeanFactory.S
* @see DubboRelaxedBindingAutoConfiguration
* @since 2.7.0
*/
@Configuration(proxyBeanMethods = false)
@Configuration
@ConditionalOnProperty(prefix = DUBBO_PREFIX, name = "enabled", matchIfMissing = true)
@ConditionalOnClass(name = "org.springframework.boot.context.properties.bind.Binder")
@AutoConfigureBefore(DubboRelaxedBindingAutoConfiguration.class)

View File

@ -62,7 +62,7 @@ public class DubboAutoConfiguration {
@ConditionalOnProperty(prefix = DUBBO_SCAN_PREFIX, name = BASE_PACKAGES_PROPERTY_NAME)
@ConditionalOnBean(name = BASE_PACKAGES_BEAN_NAME)
@Bean
public static ServiceAnnotationPostProcessor serviceAnnotationBeanProcessor(
public ServiceAnnotationPostProcessor serviceAnnotationBeanProcessor(
@Qualifier(BASE_PACKAGES_BEAN_NAME) Set<String> packagesToScan) {
return new ServiceAnnotationPostProcessor(packagesToScan);
}

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((zipkin2.reporter.BytesEncoder<Span>) encoder);
return AsyncReporter.builder(sender).build(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.reporter.Call;
import zipkin2.reporter.Callback;
import zipkin2.Call;
import zipkin2.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.reporter.Call;
import zipkin2.reporter.Callback;
import zipkin2.Call;
import zipkin2.Callback;
class ZipkinWebClientSender extends HttpSender {
private final String endpoint;

View File

@ -36,10 +36,10 @@
</modules>
<properties>
<micrometer.version>1.13.1</micrometer.version>
<micrometer-tracing.version>1.3.1</micrometer-tracing.version>
<opentelemetry.version>1.39.0</opentelemetry.version>
<zipkin-reporter.version>3.4.0</zipkin-reporter.version>
<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>
<prometheus-client.version>0.16.0</prometheus-client.version>
</properties>

View File

@ -43,7 +43,7 @@
<!-- Fix the bug of log4j refer:https://github.com/apache/logging-log4j2/pull/608 -->
<log4j2_version>2.23.1</log4j2_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.17</byte-buddy.version>
<byte-buddy.version>1.14.15</byte-buddy.version>
</properties>
<dependencyManagement>

View File

@ -33,7 +33,7 @@
<curator.test.version>4.2.0</curator.test.version>
<zookeeper.version>3.7.2</zookeeper.version>
<curator5.version>4.2.0</curator5.version>
<commons.compress.version>1.26.2</commons.compress.version>
<commons.compress.version>1.26.1</commons.compress.version>
<junit.platform.launcher.version>1.9.3</junit.platform.launcher.version>
<commons.exec.version>1.4.0</commons.exec.version>
<async.http.client.version>2.12.3</async.http.client.version>

View File

@ -16,8 +16,6 @@
*/
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;
@ -135,7 +133,7 @@ class FileTest {
List<String> artifactIdsInRoot = IOUtils.readLines(
this.getClass()
.getClassLoader()
.getResource(CommonConstants.DUBBO_VERSIONS_KEY + "/.artifacts")
.getResource("META-INF/versions/.artifacts")
.openStream(),
StandardCharsets.UTF_8);
artifactIdsInRoot.removeIf(s -> s.startsWith("#"));

View File

@ -29,7 +29,7 @@
<properties>
<skip_maven_deploy>true</skip_maven_deploy>
<slf4j-log4j12.version>1.7.33</slf4j-log4j12.version>
<spring_version>5.3.37</spring_version>
<spring_version>5.3.35</spring_version>
<!--<spring_version>4.0.9.RELEASE</spring_version>-->
<!--<spring_version>4.1.9.RELEASE</spring_version>-->
<!--<spring_version>4.2.4.RELEASE</spring_version>-->

View File

@ -28,7 +28,7 @@
<properties>
<skip_maven_deploy>true</skip_maven_deploy>
<spring_version>5.3.37</spring_version>
<spring_version>5.3.35</spring_version>
</properties>
<dependencyManagement>

View File

@ -28,7 +28,7 @@
<properties>
<skip_maven_deploy>true</skip_maven_deploy>
<spring_version>5.3.37</spring_version>
<spring_version>5.3.35</spring_version>
</properties>
<dependencyManagement>

View File

@ -28,7 +28,7 @@
<properties>
<skip_maven_deploy>true</skip_maven_deploy>
<spring_version>5.3.37</spring_version>
<spring_version>5.3.35</spring_version>
</properties>
<dependencyManagement>

26
pom.xml
View File

@ -141,18 +141,18 @@
<java_target_version>1.8</java_target_version>
<file_encoding>UTF-8</file_encoding>
<!-- Maven plugins -->
<maven_jar_version>3.4.2</maven_jar_version>
<maven_surefire_version>3.3.0</maven_surefire_version>
<maven_failsafe_version>3.3.0</maven_failsafe_version>
<maven_jar_version>3.4.1</maven_jar_version>
<maven_surefire_version>3.2.5</maven_surefire_version>
<maven_failsafe_version>3.2.5</maven_failsafe_version>
<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.7.0</maven_javadoc_version>
<maven_javadoc_version>3.6.3</maven_javadoc_version>
<maven_jetty_version>9.4.54.v20240208</maven_jetty_version>
<maven_checkstyle_version>3.4.0</maven_checkstyle_version>
<maven_checkstyle_version>3.3.1</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.5.0</maven_enforce_version>
<maven_enforce_version>3.4.1</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>
@ -169,7 +169,7 @@
<spotless.action>check</spotless.action>
<dubbo-shared-resources.version>1.0.0</dubbo-shared-resources.version>
<palantirJavaFormat.version>2.38.0</palantirJavaFormat.version>
<revision>3.2.15-SNAPSHOT</revision>
<revision>3.2.13</revision>
</properties>
<dependencyManagement>
@ -253,7 +253,7 @@
</includes>
</resource>
<resource>
<targetPath>META-INF/dubbo-versions</targetPath>
<targetPath>META-INF/versions</targetPath>
<filtering>false</filtering>
<directory>${maven.multiModuleProjectDirectory}</directory>
<includes>
@ -281,7 +281,7 @@
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
<version>3.3.2</version>
</plugin>
<plugin>
<groupId>org.ops4j.pax.exam</groupId>
@ -290,7 +290,7 @@
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
<version>3.6.1</version>
</plugin>
<plugin>
<!-- Do NOT upgrade -->
@ -315,7 +315,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<version>3.5.3</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
@ -430,7 +430,7 @@
<configuration>
<failOnError>true</failOnError>
<target>
<property name="version_file" value="${project.build.outputDirectory}/META-INF/dubbo-versions/${project.artifactId}" />
<property name="version_file" value="${project.build.outputDirectory}/META-INF/versions/${project.artifactId}" />
<!-- get the current version of dubbo -->
<echo file="${version_file}" message="revision=${revision}${line.separator}" />
<!-- attach the artifact id -->
@ -448,7 +448,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.1.0</version>
<version>3.0.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>