This is an automated email from the ASF dual-hosted git repository. albumenj pushed a commit to branch 3.3 in repository https://gitbox.apache.org/repos/asf/dubbo.git
commit 598511658203ca45b7f96874b6d948582d2f3cb4 Merge: 2486674828 b9825cdbd0 Author: Albumen Kevin <[email protected]> AuthorDate: Mon Jun 17 10:00:57 2024 +0800 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 .../main/java/org/apache/dubbo/common/Version.java | 8 +++-- .../dubbo/common/constants/CommonConstants.java | 40 +++++++++++++++++++--- .../main/resources/security/serialize.blockedlist | 3 +- .../apache/dubbo/common/version/VersionTest.java | 9 +++-- dubbo-dependencies-bom/pom.xml | 6 ++-- dubbo-maven-plugin/pom.xml | 6 ++-- .../dubbo/reactive/calls/ReactorServerCalls.java | 8 ++--- .../zookeeper/util/CuratorFrameworkUtils.java | 3 ++ .../curator5/AbstractZookeeperClient.java | 1 + .../curator5/Curator5ZookeeperClient.java | 3 ++ .../apache/dubbo/rpc/filter/AccessLogFilter.java | 2 +- .../autoconfigure/exporter/zipkin/HttpSender.java | 6 ++-- .../exporter/zipkin/ZipkinConfigurations.java | 2 +- .../exporter/zipkin/ZipkinRestTemplateSender.java | 4 +-- .../exporter/zipkin/ZipkinWebClientSender.java | 4 +-- .../observability/pom.xml | 6 ++-- dubbo-spring-boot/pom.xml | 2 +- .../java/org/apache/dubbo/dependency/FileTest.java | 4 ++- pom.xml | 12 +++---- 19 files changed, 84 insertions(+), 45 deletions(-) diff --cc dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java index 92b46c77f5,704b30c74c..61537707e3 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java @@@ -279,13 -286,19 +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"; /** @@@ -575,12 -634,25 +595,20 @@@ 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; - /** - * @since 3.2.0 - */ - String BYTE_ACCESSOR_KEY = "byte.accessor"; - String PAYLOAD = "payload"; String DUBBO_METRICS_CONFIGCENTER_ENABLE = "dubbo.metrics.configcenter.enable"; @@@ -591,161 -663,11 +619,165 @@@ String DUBBO_PACKABLE_METHOD_FACTORY = "dubbo.application.parameters." + PACKABLE_METHOD_FACTORY_KEY; - String DUBBO_MANUAL_REGISTER_KEY = "dubbo.application.manual-register"; + String DUBBO_TAG_HEADER = "dubbo-tag"; + + String REST_SERVICE_DEPLOYER_URL_ATTRIBUTE_KEY = "restServiceDeployerAttributeKey"; - String DUBBO2_COMPACT_ENABLE = "dubbo.compact.enable"; + String POD_NAMESPACE = "POD_NAMESPACE"; + + String CLUSTER_DOMAIN = "CLUSTER_DOMAIN"; + + String EXT_PROTOCOL = "ext.protocol"; + + String IS_EXTRA = "isExtra"; + String ZOOKEEPER_ENSEMBLE_TRACKER_KEY = "zookeeper.ensemble.tracker"; + + String DUBBO_VERSIONS_KEY = "META-INF/dubbo-versions"; ++ + /** + * System-related VM properties + */ + interface SystemProperty { + + String USER_HOME = "user.home"; + + String SYSTEM_JAVA_VERSION = "java.version"; + + String SYSTEM_JAVA_IO_TMPDIR = "java.io.tmpdir"; + + String SYSTEM_LINE_SEPARATOR = "line.separator"; + + String SERIALIZATION_SECURITY_CHECK_KEY = "serialization.security.check"; + + String SYSTEM_BYTE_ACCESSOR_KEY = "byte.accessor"; + + String SYSTEM_OS_NAME = "os.name"; + + String SYSTEM_OS_VERSION = "os.version"; + + String JAVA_RUNTIME_NAME = "java.runtime.name"; + + String JAVA_RUNTIME_VERSION = "java.runtime.version"; + + String JAVA_VM_NAME = "java.vm.name"; + + String JAVA_VM_VERSION = "java.vm.version"; + + String JAVA_VM_INFO = "java.vm.info"; + + String JAVA_HOME = "java.home"; + + String OS_ARCH = "os.arch"; + + String SYSTEM_FILE_ENCODING = "file.encoding"; + + String SYSTEM_TCP_RESPONSE_TIMEOUT = "sun.rmi.transport.tcp.responseTimeout"; + } + + /** + * Third-party-related VM properties + */ + interface ThirdPartyProperty { + String NETTY_EPOLL_ENABLE_KEY = "netty.epoll.enable"; + + String SET_FUTURE_IN_SYNC_MODE = "future.sync.set"; + + String CLEAR_FUTURE_AFTER_GET = "future.clear.once"; + + String APOLLO_ADDR_KEY = "apollo.meta"; + + String APOLLO_CLUSTER_KEY = "apollo.cluster"; + + String APOLLO_ENV_KEY = "env"; + + String APOLLO_APPID_KEY = "app.id"; + + String NACOS_SERVICE_NAME_SEPARATOR = "nacos.service.name.separator"; + + String GRAALVM_NATIVEIMAGE_IMAGECODE = "org.graalvm.nativeimage.imagecode"; + + /** + * The JVM arguments to set if it can use embedded zookeeper, the default value is {@code true}. + */ + String ZOOKEEPER_CONFIG_ENABLE_EMBEDDED = "enableEmbeddedZookeeper"; + } + + /** + * Dubbo custom VM properties + */ + interface DubboProperty { + String DUBBO_MIGRATION_FILE_ENABLE = "dubbo.migration-file.enable"; + String DUBBO_MIGRATION_KEY = "dubbo.migration.file"; + String DUBBO_APPLICATION_LOGGER = "dubbo.application.logger"; + String DUBBO_PROPERTIES_KEY = "dubbo.properties.file"; + String DUBBO_PREFER_JSON_FRAMEWORK_NAME = "dubbo.json-framework.prefer"; + + /** + * used in JVMUtil.java ,Control stack print lines, default is 32 lines + */ + 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 + */ + String DUBBO_PREFERRED_NETWORK_INTERFACE = "dubbo.network.interface.preferred"; + + String DUBBO_CLASS_DESERIALIZE_ALLOWED_LIST = "dubbo.security.serialize.allowedClassList"; + String DUBBO_CLASS_DESERIALIZE_BLOCKED_LIST = "dubbo.security.serialize.blockedClassList"; + String DUBBO_CLASS_DESERIALIZE_OPEN_CHECK = "dubbo.security.serialize.openCheckClass"; + String DUBBO_CLASS_DESERIALIZE_BLOCK_ALL = "dubbo.security.serialize.blockAllClassExceptAllow"; + String DUBBO_RESOLVE_FILE = "dubbo.resolve.file"; + String DUBBO_IP_TO_REGISTRY = "DUBBO_IP_TO_REGISTRY"; + String DUBBO_MONITOR_ADDRESS = "dubbo.monitor.address"; + String DUBBO_CONTAINER_KEY = "dubbo.container"; + String DUBBO_SHUTDOWN_HOOK_KEY = "dubbo.shutdown.hook"; + String DUBBO_SPRING_CONFIG = "dubbo.spring.config"; + String DUBBO_MAPPING_CACHE_FILEPATH = "dubbo.mapping.cache.filePath"; + + String DUBBO_MAPPING_CACHE_FILENAME = "dubbo.mapping.cache.fileName"; + + String DUBBO_MAPPING_CACHE_ENTRYSIZE = "dubbo.mapping.cache.entrySize"; + + String DUBBO_MAPPING_CACHE_MAXFILESIZE = "dubbo.mapping.cache.maxFileSize"; + + String DUBBO_META_CACHE_FILEPATH = "dubbo.meta.cache.filePath"; + + String DUBBO_META_CACHE_FILENAME = "dubbo.meta.cache.fileName"; + + String DUBBO_META_CACHE_ENTRYSIZE = "dubbo.meta.cache.entrySize"; + + String DUBBO_META_CACHE_MAXFILESIZE = "dubbo.meta.cache.maxFileSize"; + + String DUBBO_USE_SECURE_RANDOM_ID = "dubbo.application.use-secure-random-request-id"; + + String DUBBO_CLOSE_TIMEOUT_CONFIG_KEY = "dubbo.protocol.default-close-timeout"; + + String DUBBO_HEARTBEAT_CONFIG_KEY = "dubbo.protocol.default-heartbeat"; + + String DUBBO_DEFAULT_REMOTING_SERIALIZATION_PROPERTY = "DUBBO_DEFAULT_SERIALIZATION"; + + String DUBBO_HESSIAN_ALLOW_NON_SERIALIZABLE = "dubbo.hessian.allowNonSerializable"; + + String DUBBO_HESSIAN_WHITELIST = "dubbo.application.hessian2.whitelist"; + + String DUBBO_HESSIAN_ALLOW = "dubbo.application.hessian2.allow"; + + String DUBBO_HESSIAN_DENY = "dubbo.application.hessian2.deny"; + + String DUBBO_MANUAL_REGISTER_KEY = "dubbo.application.manual-register"; + + String DUBBO2_COMPACT_ENABLE = "dubbo.compact.enable"; + } } diff --cc dubbo-dependencies-bom/pom.xml index f9a5420ff5,0bd68d0ec6..b2e45cf701 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@@ -93,15 -93,14 +93,15 @@@ <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> - <bytebuddy.version>1.14.17</bytebuddy.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.0</zookeeper_version> + <zookeeper_version>3.7.2</zookeeper_version> <curator_version>5.1.0</curator_version> <curator_test_version>2.12.0</curator_test_version> <jedis_version>3.10.0</jedis_version> @@@ -122,9 -120,8 +122,9 @@@ <commons_lang3_version>3.14.0</commons_lang3_version> <envoy_api_version>0.1.35</envoy_api_version> <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> diff --cc dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/AbstractZookeeperClient.java index fe7a9b6015,0000000000..701a4391aa mode 100644,000000..100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/AbstractZookeeperClient.java +++ b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/main/java/org/apache/dubbo/remoting/zookeeper/curator5/AbstractZookeeperClient.java @@@ -1,266 -1,0 +1,267 @@@ +/* + * 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.remoting.zookeeper.curator5; + +import org.apache.dubbo.common.URL; +import org.apache.dubbo.common.config.configcenter.ConfigItem; +import org.apache.dubbo.common.logger.ErrorTypeAwareLogger; +import org.apache.dubbo.common.logger.LoggerFactory; +import org.apache.dubbo.common.utils.ConcurrentHashMapUtils; +import org.apache.dubbo.common.utils.ConcurrentHashSet; + +import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.CopyOnWriteArraySet; +import java.util.concurrent.Executor; + +import static org.apache.dubbo.common.constants.LoggerCodeConstants.REGISTRY_ZOOKEEPER_EXCEPTION; + +public abstract class AbstractZookeeperClient<TargetDataListener, TargetChildListener> implements ZookeeperClient { + + protected static final ErrorTypeAwareLogger logger = + LoggerFactory.getErrorTypeAwareLogger(AbstractZookeeperClient.class); + + // 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; + + private final Set<StateListener> stateListeners = new CopyOnWriteArraySet<>(); + + private final ConcurrentMap<String, ConcurrentMap<ChildListener, TargetChildListener>> childListeners = + new ConcurrentHashMap<>(); + + private final ConcurrentMap<String, ConcurrentMap<DataListener, TargetDataListener>> listeners = + new ConcurrentHashMap<>(); + + private volatile boolean closed = false; + + private final Set<String> persistentExistNodePath = new ConcurrentHashSet<>(); + + public AbstractZookeeperClient(URL url) { + this.url = url; + } + + @Override + public URL getUrl() { + return url; + } + + @Override + public void delete(String path) { + // never mind if ephemeral + persistentExistNodePath.remove(path); + deletePath(path); + } + + @Override + public void create(String path, boolean ephemeral, boolean faultTolerant) { + if (!ephemeral) { + if (persistentExistNodePath.contains(path)) { + return; + } + if (checkExists(path)) { + persistentExistNodePath.add(path); + return; + } + } + int i = path.lastIndexOf('/'); + if (i > 0) { + create(path.substring(0, i), false, true); + } + if (ephemeral) { + createEphemeral(path, faultTolerant); + } else { + createPersistent(path, faultTolerant); + persistentExistNodePath.add(path); + } + } + + @Override + public void addStateListener(StateListener listener) { + stateListeners.add(listener); + } + + @Override + public void removeStateListener(StateListener listener) { + stateListeners.remove(listener); + } + + public Set<StateListener> getSessionListeners() { + return stateListeners; + } + + @Override + public List<String> addChildListener(String path, final ChildListener listener) { + ConcurrentMap<ChildListener, TargetChildListener> listeners = + ConcurrentHashMapUtils.computeIfAbsent(childListeners, path, k -> new ConcurrentHashMap<>()); + TargetChildListener targetListener = + ConcurrentHashMapUtils.computeIfAbsent(listeners, listener, k -> createTargetChildListener(path, k)); + return addTargetChildListener(path, targetListener); + } + + @Override + public void addDataListener(String path, DataListener listener) { + this.addDataListener(path, listener, null); + } + + @Override + public void addDataListener(String path, DataListener listener, Executor executor) { + ConcurrentMap<DataListener, TargetDataListener> dataListenerMap = + ConcurrentHashMapUtils.computeIfAbsent(listeners, path, k -> new ConcurrentHashMap<>()); + TargetDataListener targetListener = ConcurrentHashMapUtils.computeIfAbsent( + dataListenerMap, listener, k -> createTargetDataListener(path, k)); + addTargetDataListener(path, targetListener, executor); + } + + @Override + public void removeDataListener(String path, DataListener listener) { + ConcurrentMap<DataListener, TargetDataListener> dataListenerMap = listeners.get(path); + if (dataListenerMap != null) { + TargetDataListener targetListener = dataListenerMap.remove(listener); + if (targetListener != null) { + removeTargetDataListener(path, targetListener); + } + } + } + + @Override + public void removeChildListener(String path, ChildListener listener) { + ConcurrentMap<ChildListener, TargetChildListener> listeners = childListeners.get(path); + if (listeners != null) { + TargetChildListener targetListener = listeners.remove(listener); + if (targetListener != null) { + removeTargetChildListener(path, targetListener); + } + } + } + + protected void stateChanged(int state) { + for (StateListener sessionListener : getSessionListeners()) { + sessionListener.stateChanged(state); + } + } + + @Override + public void close() { + if (closed) { + return; + } + closed = true; + try { + doClose(); + } catch (Exception e) { + logger.warn(REGISTRY_ZOOKEEPER_EXCEPTION, "", "", e.getMessage(), e); + } + } + + @Override + public void createOrUpdate(String path, String content, boolean ephemeral) { + int i = path.lastIndexOf('/'); + if (i > 0) { + create(path.substring(0, i), false, true); + } + if (ephemeral) { + createOrUpdateEphemeral(path, content); + } else { + createOrUpdatePersistent(path, content); + } + } + + @Override + public void createOrUpdate(String path, String content, boolean ephemeral, Integer version) { + int i = path.lastIndexOf('/'); + if (i > 0) { + create(path.substring(0, i), false, true); + } + if (ephemeral) { + createOrUpdateEphemeral(path, content, version); + } else { + createOrUpdatePersistent(path, content, version); + } + } + + @Override + public String getContent(String path) { + if (!checkExists(path)) { + return null; + } + return doGetContent(path); + } + + @Override + public ConfigItem getConfigItem(String path) { + return doGetConfigItem(path); + } + + protected void doClose() { + // Break circular reference of zk client + stateListeners.clear(); + } + + protected abstract void createPersistent(String path, boolean faultTolerant); + + protected abstract void createEphemeral(String path, boolean faultTolerant); + + protected abstract void createPersistent(String path, String data, boolean faultTolerant); + + protected abstract void createEphemeral(String path, String data, boolean faultTolerant); + + protected abstract void update(String path, String data, int version); + + protected abstract void update(String path, String data); + + protected abstract void createOrUpdatePersistent(String path, String data); + + protected abstract void createOrUpdateEphemeral(String path, String data); + + protected abstract void createOrUpdatePersistent(String path, String data, Integer version); + + protected abstract void createOrUpdateEphemeral(String path, String data, Integer version); + + @Override + public abstract boolean checkExists(String path); + + protected abstract TargetChildListener createTargetChildListener(String path, ChildListener listener); + + protected abstract List<String> addTargetChildListener(String path, TargetChildListener listener); + + protected abstract TargetDataListener createTargetDataListener(String path, DataListener listener); + + protected abstract void addTargetDataListener(String path, TargetDataListener listener); + + protected abstract void addTargetDataListener(String path, TargetDataListener listener, Executor executor); + + protected abstract void removeTargetDataListener(String path, TargetDataListener listener); + + protected abstract void removeTargetChildListener(String path, TargetChildListener listener); + + protected abstract String doGetContent(String path); + + protected abstract ConfigItem doGetConfigItem(String path); + + /** + * we invoke the zookeeper client to delete the node + * + * @param path the node path + */ + protected abstract void deletePath(String path); +} diff --cc dubbo-spring-boot/pom.xml index f6ce540332,1e097e4b35..96fb40c057 --- a/dubbo-spring-boot/pom.xml +++ b/dubbo-spring-boot/pom.xml @@@ -41,9 -39,11 +41,9 @@@ <properties> <spring-boot.version>2.7.18</spring-boot.version> - <dubbo.version>${revision}</dubbo.version> - <!-- 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.15</byte-buddy.version> + <byte-buddy.version>1.14.17</byte-buddy.version> + <mockito_version>4.11.0</mockito_version> </properties> <dependencyManagement>
