From ed9cb9550c96b8878a83b902f6a605f5e4a94ef6 Mon Sep 17 00:00:00 2001 From: Mercy Ma Date: Wed, 8 Jul 2020 14:07:04 +0800 Subject: [PATCH] [2.7.8] Migration the latest Nacos registry implementation to upstream (#6417) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * 2.7.8 service introspection (#6300) * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * 2.7.8 service introspection update (#6308) * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert the MetadataReport * Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event * Polish apache/dubbo#6310 : Refactoring MetadataReport's methods * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation of MetadataReport based on The Config-Center infrastructure Deprecated List : - NacosMetadataReport - ZookeeperMetadataReport * Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Reset the config base path to be "metadata" for ConfigCenterBasedMetadataReportFactory * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Bugfix * 2.7.8 service introspection (#6317) * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert the MetadataReport * Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6310 : Refactoring MetadataReport's methods * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation of MetadataReport based on The Config-Center infrastructure Deprecated List : - NacosMetadataReport - ZookeeperMetadataReport * Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Reset the config base path to be "metadata" for ConfigCenterBasedMetadataReportFactory * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Correct words * Polish apache/dubbo#6333 : [Refactor] Using mandatory implementation of Service Instance registration instead of the event * Polish apache/dubbo#6336 : [Refactor] org.apache.dubbo.metadata.ServiceNameMapping * 2.7.8 service introspection (#6337) * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert the MetadataReport * Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6310 : Refactoring MetadataReport's methods * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation of MetadataReport based on The Config-Center infrastructure Deprecated List : - NacosMetadataReport - ZookeeperMetadataReport * Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Reset the config base path to be "metadata" for ConfigCenterBasedMetadataReportFactory * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Correct words * Polish apache/dubbo#6333 : [Refactor] Using mandatory implementation of Service Instance registration instead of the event * Polish apache/dubbo#6336 : [Refactor] org.apache.dubbo.metadata.ServiceNameMapping * Polish apache/dubbo#6170 : [Feature] Introducing the externalized configuration for ServiceNameMapping * Polish apache/dubbo#6342 : [Enhancement] Introducing the composite ServiceNameMapping * Refactor * Polish apache/dubbo#6172 : [Feature] Adding the "services" attribute methods into @DubboReference * Polish apache/dubbo#6173 : [Feature] Adding the "services" attribute into element * Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from the multiple services * Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from the multiple services * Polish apache/dubbo#6252 * Polish apache/dubbo#6356 & apache/dubbo#6171 * Polish apache/dubbo#6356 & apache/dubbo#6171 * Polish apache/dubbo#6224 : Filter chain was not invoked with local calls since v2.7.6 * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * 2.7.8 service introspection (#6366) * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert the MetadataReport * Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6310 : Refactoring MetadataReport's methods * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation of MetadataReport based on The Config-Center infrastructure Deprecated List : - NacosMetadataReport - ZookeeperMetadataReport * Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Reset the config base path to be "metadata" for ConfigCenterBasedMetadataReportFactory * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Correct words * Polish apache/dubbo#6333 : [Refactor] Using mandatory implementation of Service Instance registration instead of the event * Polish apache/dubbo#6336 : [Refactor] org.apache.dubbo.metadata.ServiceNameMapping * Polish apache/dubbo#6170 : [Feature] Introducing the externalized configuration for ServiceNameMapping * Polish apache/dubbo#6342 : [Enhancement] Introducing the composite ServiceNameMapping * Refactor * Polish apache/dubbo#6172 : [Feature] Adding the "services" attribute methods into @DubboReference * Polish apache/dubbo#6173 : [Feature] Adding the "services" attribute into element * Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from the multiple services * Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from the multiple services * Polish apache/dubbo#6252 * Polish apache/dubbo#6356 & apache/dubbo#6171 * Polish apache/dubbo#6356 & apache/dubbo#6171 * Polish apache/dubbo#6224 : Filter chain was not invoked with local calls since v2.7.6 * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : Adding META-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * 2.7.8 Test Cases (#6384) * Polish apache/dubbo#6152 * Polish apache/dubbo#6174 : [Enhancement] Registering the common beans for Spring XML meta-configuration * Polish apache/dubbo#6174 : Fixing the test-cases * Polish apache/dubbo#6174 : Fixing the test-cases * Add the test-case for multiple services with MethodConfigs * Fixed the test-cases * 2.7.8 Dev (#6386) * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6296 : Adding the new methods into MetadataReport to manipulate the exported URLs for service introspection * Polish apache/dubbo#6171 : [Feature] Introducing the composite implementation of MetadataService * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert "fix wrong check of InvokerListener when export a service (fix issue_6269) (#6271)" This reverts commit 91989cae508f8482f31ac335879da4a5975661c8. * Revert the MetadataReport * Polish apache/dubbo#6305 : [Refactor] ServiceConfig and ReferenceConfig publish the ServiceDefinition based on the Dubbo Event * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6310 : Refactoring MetadataReport's methods * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6198 : [Issue] Fixing NacosDynamicConfiguration#publishConfig bug * Polish apache/dubbo#6315 : [Refactor] Refactoring the implementation of MetadataReport based on The Config-Center infrastructure Deprecated List : - NacosMetadataReport - ZookeeperMetadataReport * Polish apache/dubbo#6315 : Refactoring by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Refactoring ConsulDynamicConfiguration by TreePathDynamicConfiguration * Polish apache/dubbo#6315 : Reset the config base path to be "metadata" for ConfigCenterBasedMetadataReportFactory * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Bugfix * Polish apache/dubbo#6315 : Correct words * sync wait netty server to finish shutdown (#6281) * Polish apache/dubbo#6333 : [Refactor] Using mandatory implementation of Service Instance registration instead of the event * maybe we can remove null judge in this case (#6321) * update * update * Polish apache/dubbo#6336 : [Refactor] org.apache.dubbo.metadata.ServiceNameMapping * Polish apache/dubbo#6170 : [Feature] Introducing the externalized configuration for ServiceNameMapping * Polish apache/dubbo#6342 : [Enhancement] Introducing the composite ServiceNameMapping * Refactor * fix method name typo in JValidator.java (#6344) * [Dubbo-6340]fix application cannot exit when use consul registry (#6341) * fix application cannot exit when use consul registry * make consul registry suppor ACL (#6313) * make consul registry suppor ACL * Polish apache/dubbo#6172 : [Feature] Adding the "services" attribute methods into @DubboReference * Polish apache/dubbo#6173 : [Feature] Adding the "services" attribute into element * Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from the multiple services * Polish apache/dubbo#6346 : [Issue] Merging all subscribied URLs from the multiple services * fix publish null value when use consul config center (#6351) * fix publish null value when use consul config center * Polish apache/dubbo#6252 * Polish apache/dubbo#6356 & apache/dubbo#6171 * Polish apache/dubbo#6356 & apache/dubbo#6171 * Polish apache/dubbo#6224 : Filter chain was not invoked with local calls since v2.7.6 * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : Adding META-INF/dubbo/internal/org.apache.dubbo.metadata.MetadataServiceExporter * fix the priority of ListenableRouter were not effective (#6148) fixes #4822 * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * when the url is generic, the log level should be info (#6363) * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * fix NPE when check=false is set and provider is empty. (#6376) fixes #6228 * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * fix #6306. support TypeBuilder sort (#6365) * fix #6306. support TypeBuilder sort * fix #6306. support TypeBuilder sort * fix #6306. support TypeBuilder sort * remove unused import * add license for test file * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * enhance ClusterInvoker & ExtensionLoader (#6343) - Introduce ClusterInvoker to better support multiple registries subscription - Wrapper sort and enable/disable - some small fixes * Polish apache/dubbo#6322 : [Enhancement] Fix the issues of test-cases after refactoring * Fixed the test-cases Co-authored-by: tswstarplanet Co-authored-by: Nine Co-authored-by: 陈哈哈 Co-authored-by: luoning810 <18311333766@163.com> Co-authored-by: cvictory Co-authored-by: ken.lj * Fixes the issue of merging code in Github * Polish apache/dubbo#6389 : [Issue] Resolving the issues with ConsulServiceDiscovery * Fixes the test-cases * Fixes the test-cases * Fixes the test-cases * Upgrade the release version to be 2.7.8 * Hessian2 whitelist (#6378) fixes #6364 * Polish apache/dubbo#6261 : Migration the latest Nacos registry implementation to upstream * Hessian whitelist2 (#6423) * Polish apache/dubbo#6425 : [Infrastructure] Upgrading the spring-context-support to be 1.0.7 * double check lock (#6422) * Correction: comments about multipleConfig (#6414) * Polish apache/dubbo#6418 : Rest Protocol can't work when use Tomcat 9.0.x as web container for Dubbo 2.7.7 * fix bug: Rest Protocol can't work when use Tomcat as WebContainer (#6402) Co-authored-by: 01376420 <1qaz!QAZ> Co-authored-by: tswstarplanet Co-authored-by: Nine Co-authored-by: 陈哈哈 Co-authored-by: luoning810 <18311333766@163.com> Co-authored-by: cvictory Co-authored-by: ken.lj Co-authored-by: diguage Co-authored-by: 月泉 Co-authored-by: 星尘 --- dubbo-dependencies-bom/pom.xml | 2 +- .../nacos/util/NacosNamingServiceUtils.java | 45 ++++--------------- .../http/tomcat/TomcatHttpServer.java | 10 +++-- .../hessian2/Hessian2SerializerFactory.java | 2 +- 4 files changed, 17 insertions(+), 42 deletions(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 1fbbaa81dbc..770bf1e5bc6 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -146,7 +146,7 @@ 1.9.12 - 1.0.6 + 1.0.7 2.2.7 1.2.0 diff --git a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java index 789adeefaad..cdfcf8a839a 100644 --- a/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java +++ b/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/util/NacosNamingServiceUtils.java @@ -24,35 +24,20 @@ import org.apache.dubbo.registry.client.ServiceInstance; import com.alibaba.nacos.api.NacosFactory; +import com.alibaba.nacos.api.PropertyKeyConst; import com.alibaba.nacos.api.exception.NacosException; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.utils.NamingUtils; +import java.util.Map; import java.util.Properties; -import static com.alibaba.nacos.api.PropertyKeyConst.ACCESS_KEY; -import static com.alibaba.nacos.api.PropertyKeyConst.CLUSTER_NAME; -import static com.alibaba.nacos.api.PropertyKeyConst.CONFIG_LONG_POLL_TIMEOUT; -import static com.alibaba.nacos.api.PropertyKeyConst.CONFIG_RETRY_TIME; -import static com.alibaba.nacos.api.PropertyKeyConst.CONTEXT_PATH; -import static com.alibaba.nacos.api.PropertyKeyConst.ENABLE_REMOTE_SYNC_CONFIG; -import static com.alibaba.nacos.api.PropertyKeyConst.ENCODE; -import static com.alibaba.nacos.api.PropertyKeyConst.ENDPOINT; -import static com.alibaba.nacos.api.PropertyKeyConst.ENDPOINT_PORT; -import static com.alibaba.nacos.api.PropertyKeyConst.IS_USE_CLOUD_NAMESPACE_PARSING; -import static com.alibaba.nacos.api.PropertyKeyConst.IS_USE_ENDPOINT_PARSING_RULE; -import static com.alibaba.nacos.api.PropertyKeyConst.MAX_RETRY; -import static com.alibaba.nacos.api.PropertyKeyConst.NAMESPACE; -import static com.alibaba.nacos.api.PropertyKeyConst.NAMING_CLIENT_BEAT_THREAD_COUNT; import static com.alibaba.nacos.api.PropertyKeyConst.NAMING_LOAD_CACHE_AT_START; -import static com.alibaba.nacos.api.PropertyKeyConst.NAMING_POLLING_THREAD_COUNT; -import static com.alibaba.nacos.api.PropertyKeyConst.RAM_ROLE_NAME; -import static com.alibaba.nacos.api.PropertyKeyConst.SECRET_KEY; import static com.alibaba.nacos.api.PropertyKeyConst.SERVER_ADDR; import static com.alibaba.nacos.api.common.Constants.DEFAULT_GROUP; -import static com.alibaba.nacos.client.naming.utils.UtilAndComs.NACOS_NAMING_LOG_NAME; import static org.apache.dubbo.common.constants.RemotingConstants.BACKUP_KEY; +import static org.apache.dubbo.common.utils.StringConstantFieldValuePredicate.of; /** * The utilities class for {@link NamingService} @@ -154,25 +139,13 @@ private static void setServerAddr(URL url, Properties properties) { } private static void setProperties(URL url, Properties properties) { - putPropertyIfAbsent(url, properties, NACOS_NAMING_LOG_NAME); - putPropertyIfAbsent(url, properties, IS_USE_CLOUD_NAMESPACE_PARSING); - putPropertyIfAbsent(url, properties, IS_USE_ENDPOINT_PARSING_RULE); - putPropertyIfAbsent(url, properties, ENDPOINT); - putPropertyIfAbsent(url, properties, ENDPOINT_PORT); - putPropertyIfAbsent(url, properties, NAMESPACE); - putPropertyIfAbsent(url, properties, ACCESS_KEY); - putPropertyIfAbsent(url, properties, SECRET_KEY); - putPropertyIfAbsent(url, properties, RAM_ROLE_NAME); - putPropertyIfAbsent(url, properties, CONTEXT_PATH); - putPropertyIfAbsent(url, properties, CLUSTER_NAME); - putPropertyIfAbsent(url, properties, ENCODE); - putPropertyIfAbsent(url, properties, CONFIG_LONG_POLL_TIMEOUT); - putPropertyIfAbsent(url, properties, CONFIG_RETRY_TIME); - putPropertyIfAbsent(url, properties, MAX_RETRY); - putPropertyIfAbsent(url, properties, ENABLE_REMOTE_SYNC_CONFIG); + // @since 2.7.8 : Refactoring + // Get the parameters from constants + Map parameters = url.getParameters(of(PropertyKeyConst.class)); + // Put all parameters + properties.putAll(parameters); + putPropertyIfAbsent(url, properties, NAMING_LOAD_CACHE_AT_START, "true"); - putPropertyIfAbsent(url, properties, NAMING_CLIENT_BEAT_THREAD_COUNT); - putPropertyIfAbsent(url, properties, NAMING_POLLING_THREAD_COUNT); } private static void putPropertyIfAbsent(URL url, Properties properties, String propertyName) { diff --git a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java index 167653a8752..07115901f13 100755 --- a/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java +++ b/dubbo-remoting/dubbo-remoting-http/src/main/java/org/apache/dubbo/remoting/http/tomcat/TomcatHttpServer.java @@ -31,8 +31,8 @@ import java.io.File; -import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_THREADS; +import static org.apache.dubbo.common.constants.CommonConstants.THREADS_KEY; import static org.apache.dubbo.remoting.Constants.ACCEPTS_KEY; public class TomcatHttpServer extends AbstractHttpServer { @@ -51,21 +51,23 @@ public TomcatHttpServer(URL url, final HttpHandler handler) { String baseDir = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath(); tomcat = new Tomcat(); - Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); + Connector connector = tomcat.getConnector(); connector.setPort(url.getPort()); connector.setProperty("maxThreads", String.valueOf(url.getParameter(THREADS_KEY, DEFAULT_THREADS))); connector.setProperty("maxConnections", String.valueOf(url.getParameter(ACCEPTS_KEY, -1))); connector.setProperty("URIEncoding", "UTF-8"); connector.setProperty("connectionTimeout", "60000"); connector.setProperty("maxKeepAliveRequests", "-1"); - tomcat.setConnector(connector); tomcat.setBaseDir(baseDir); tomcat.setPort(url.getPort()); Context context = tomcat.addContext("/", baseDir); Tomcat.addServlet(context, "dispatcher", new DispatcherServlet()); - context.addServletMapping("/*", "dispatcher"); + // Issue : https://github.com/apache/dubbo/issues/6418 + // addServletMapping method will be removed since Tomcat 9 + // context.addServletMapping("/*", "dispatcher"); + context.addServletMappingDecoded("/*", "dispatcher"); ServletManager.getInstance().addServletContext(url.getPort(), context.getServletContext()); // tell tomcat to fail on startup failures. diff --git a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializerFactory.java b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializerFactory.java index 6a8db878977..f41e7dc35bf 100644 --- a/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializerFactory.java +++ b/dubbo-serialization/dubbo-serialization-hessian2/src/main/java/org/apache/dubbo/common/serialize/hessian2/Hessian2SerializerFactory.java @@ -28,4 +28,4 @@ public ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); } -} +} \ No newline at end of file