From cbda1fa64a35ab0f986b1eea9bcffcc4e77ab242 Mon Sep 17 00:00:00 2001 From: crazyhzm Date: Thu, 16 May 2019 17:59:56 +0800 Subject: [PATCH] constant step4 config --- .../common/constants/ConfigConstants.java | 93 -------------- .../apache/dubbo/config/MethodConfigTest.java | 12 +- .../dubbo/config/AbstractInterfaceConfig.java | 8 +- .../dubbo/config/ApplicationConfig.java | 16 +-- .../dubbo/config/ConfigCenterConfig.java | 8 +- .../org/apache/dubbo/config/Constants.java | 116 ++++++++++++++++++ .../org/apache/dubbo/config/MethodConfig.java | 12 +- .../org/apache/dubbo/config/ModuleConfig.java | 6 +- .../apache/dubbo/config/ProtocolConfig.java | 2 +- .../apache/dubbo/config/ProviderConfig.java | 4 +- .../apache/dubbo/config/ReferenceConfig.java | 2 +- .../apache/dubbo/config/RegistryConfig.java | 2 +- .../apache/dubbo/config/ServiceConfig.java | 12 +- .../config/builders/ApplicationBuilder.java | 2 +- .../apache/dubbo/config/MethodConfigTest.java | 14 +-- .../dubbo/config/RegistryConfigTest.java | 2 +- .../dubbo/config/ServiceConfigTest.java | 2 +- .../dubbo/rpc/protocol/dubbo/Constants.java | 4 + .../rpc/protocol/dubbo/DubboProtocol.java | 4 +- .../rpc/protocol/dubbo/FutureFilterTest.java | 2 +- 20 files changed, 175 insertions(+), 148 deletions(-) create mode 100644 dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/Constants.java diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ConfigConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ConfigConstants.java index 7f6351e605f..44deb2c8041 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ConfigConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ConfigConstants.java @@ -23,67 +23,11 @@ public interface ConfigConstants { String CLUSTER_KEY = "cluster"; - String STATUS_KEY = "status"; - - String CONTEXTPATH_KEY = "contextpath"; - - String LISTENER_KEY = "listener"; - - String LAYER_KEY = "layer"; - - /** - * General - */ - /** - * Application name; - */ - String NAME = "name"; - - /** - * Application owner name; - */ - String OWNER = "owner"; - - /** - * Running application organization name. - */ - String ORGANIZATION = "organization"; - - /** - * Application architecture name. - */ - String ARCHITECTURE = "architecture"; - - /** - * Environment name - */ - String ENVIRONMENT = "environment"; - - /** - * Test environment key. - */ - String TEST_ENVIRONMENT = "test"; - - /** - * Development environment key. - */ - String DEVELOPMENT_ENVIRONMENT = "develop"; - - /** - * Production environment key. - */ - String PRODUCTION_ENVIRONMENT = "product"; - String CONFIG_CLUSTER_KEY = "config.cluster"; String CONFIG_NAMESPACE_KEY = "config.namespace"; String CONFIG_GROUP_KEY = "config.group"; String CONFIG_CHECK_KEY = "config.check"; - String CONFIG_CONFIGFILE_KEY = "config.config-file"; - String CONFIG_ENABLE_KEY = "config.highest-priority"; - String CONFIG_TIMEOUT_KEY = "config.timeout"; - String CONFIG_APPNAME_KEY = "config.app-name"; - String USERNAME_KEY = "username"; String PASSWORD_KEY = "password"; @@ -92,42 +36,16 @@ public interface ConfigConstants { String PORT_KEY = "port"; - String MULTICAST = "multicast"; - String REGISTER_IP_KEY = "register.ip"; - String DUBBO_IP_TO_REGISTRY = "DUBBO_IP_TO_REGISTRY"; - - String DUBBO_PORT_TO_REGISTRY = "DUBBO_PORT_TO_REGISTRY"; - String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND"; - String DUBBO_PORT_TO_BIND = "DUBBO_PORT_TO_BIND"; - String SCOPE_KEY = "scope"; String SCOPE_LOCAL = "local"; String SCOPE_REMOTE = "remote"; - String SCOPE_NONE = "none"; - - String ON_CONNECT_KEY = "onconnect"; - - String ON_DISCONNECT_KEY = "ondisconnect"; - - String ON_INVOKE_METHOD_KEY = "oninvoke.method"; - - String ON_RETURN_METHOD_KEY = "onreturn.method"; - - String ON_THROW_METHOD_KEY = "onthrow.method"; - - String ON_INVOKE_INSTANCE_KEY = "oninvoke.instance"; - - String ON_RETURN_INSTANCE_KEY = "onreturn.instance"; - - String ON_THROW_INSTANCE_KEY = "onthrow.instance"; - @Deprecated String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds"; @@ -152,17 +70,6 @@ public interface ConfigConstants { String ZOOKEEPER_PROTOCOL = "zookeeper"; - // FIXME: is this still useful? - String SHUTDOWN_TIMEOUT_KEY = "shutdown.timeout"; - - int DEFAULT_SHUTDOWN_TIMEOUT = 1000 * 60 * 15; - - String PROTOCOLS_SUFFIX = "dubbo.protocols."; - - String PROTOCOL_SUFFIX = "dubbo.protocol."; - - String REGISTRIES_SUFFIX = "dubbo.registries."; - String TELNET = "telnet"; String QOS_ENABLE = "qos.enable"; diff --git a/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java b/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java index 1681dd4d9dd..06eada996ec 100644 --- a/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java +++ b/dubbo-compatible/src/test/java/org/apache/dubbo/config/MethodConfigTest.java @@ -29,12 +29,12 @@ import java.util.HashMap; import java.util.Map; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_INVOKE_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_INVOKE_METHOD_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_RETURN_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_RETURN_METHOD_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_INVOKE_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_INVOKE_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_RETURN_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_RETURN_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_METHOD_KEY; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java index f94f148ec6e..143d085f088 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractInterfaceConfig.java @@ -65,13 +65,13 @@ import static org.apache.dubbo.common.constants.CommonConstants.RELEASE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.CLUSTER_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_IP_TO_REGISTRY; +import static org.apache.dubbo.config.Constants.DUBBO_IP_TO_REGISTRY; import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PROTOCOL; -import static org.apache.dubbo.common.constants.ConfigConstants.LAYER_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.LISTENER_KEY; +import static org.apache.dubbo.config.Constants.LAYER_KEY; +import static org.apache.dubbo.config.Constants.LISTENER_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.REFER_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.REGISTER_IP_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.REGISTRIES_SUFFIX; +import static org.apache.dubbo.config.Constants.REGISTRIES_SUFFIX; import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_SECONDS_KEY; import static org.apache.dubbo.monitor.Constants.LOGSTAT_PROTOCOL; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java index 5c13c0bd9c7..2b50e50ed72 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ApplicationConfig.java @@ -29,17 +29,17 @@ import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY; import static org.apache.dubbo.common.constants.CommonConstants.DUMP_DIRECTORY; import static org.apache.dubbo.common.constants.ConfigConstants.ACCEPT_FOREIGN_IP; -import static org.apache.dubbo.common.constants.ConfigConstants.ARCHITECTURE; -import static org.apache.dubbo.common.constants.ConfigConstants.DEVELOPMENT_ENVIRONMENT; -import static org.apache.dubbo.common.constants.ConfigConstants.ENVIRONMENT; -import static org.apache.dubbo.common.constants.ConfigConstants.NAME; -import static org.apache.dubbo.common.constants.ConfigConstants.ORGANIZATION; -import static org.apache.dubbo.common.constants.ConfigConstants.OWNER; -import static org.apache.dubbo.common.constants.ConfigConstants.PRODUCTION_ENVIRONMENT; +import static org.apache.dubbo.config.Constants.ARCHITECTURE; +import static org.apache.dubbo.config.Constants.DEVELOPMENT_ENVIRONMENT; +import static org.apache.dubbo.config.Constants.ENVIRONMENT; +import static org.apache.dubbo.config.Constants.NAME; +import static org.apache.dubbo.config.Constants.ORGANIZATION; +import static org.apache.dubbo.config.Constants.OWNER; +import static org.apache.dubbo.config.Constants.PRODUCTION_ENVIRONMENT; import static org.apache.dubbo.common.constants.ConfigConstants.QOS_ENABLE; import static org.apache.dubbo.common.constants.ConfigConstants.QOS_PORT; import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.TEST_ENVIRONMENT; +import static org.apache.dubbo.config.Constants.TEST_ENVIRONMENT; /** diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java index 5334f0492c5..d65f2e2018d 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ConfigCenterConfig.java @@ -28,14 +28,14 @@ import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY; import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_APPNAME_KEY; +import static org.apache.dubbo.config.Constants.CONFIG_APPNAME_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_CHECK_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_CLUSTER_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_CONFIGFILE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_ENABLE_KEY; +import static org.apache.dubbo.config.Constants.CONFIG_CONFIGFILE_KEY; +import static org.apache.dubbo.config.Constants.CONFIG_ENABLE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_GROUP_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_NAMESPACE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.CONFIG_TIMEOUT_KEY; +import static org.apache.dubbo.config.Constants.CONFIG_TIMEOUT_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.ZOOKEEPER_PROTOCOL; /** diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/Constants.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/Constants.java new file mode 100644 index 00000000000..3842e01dd16 --- /dev/null +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/Constants.java @@ -0,0 +1,116 @@ +/* + * 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.config; + +/** + * + */ +public interface Constants { + + String STATUS_KEY = "status"; + + String CONTEXTPATH_KEY = "contextpath"; + + String LISTENER_KEY = "listener"; + + String LAYER_KEY = "layer"; + + /** + * General + */ + /** + * Application name; + */ + String NAME = "name"; + + /** + * Application owner name; + */ + String OWNER = "owner"; + + /** + * Running application organization name. + */ + String ORGANIZATION = "organization"; + + /** + * Application architecture name. + */ + String ARCHITECTURE = "architecture"; + + /** + * Environment name + */ + String ENVIRONMENT = "environment"; + + /** + * Test environment key. + */ + String TEST_ENVIRONMENT = "test"; + + /** + * Development environment key. + */ + String DEVELOPMENT_ENVIRONMENT = "develop"; + + /** + * Production environment key. + */ + String PRODUCTION_ENVIRONMENT = "product"; + + String CONFIG_CONFIGFILE_KEY = "config.config-file"; + String CONFIG_ENABLE_KEY = "config.highest-priority"; + String CONFIG_TIMEOUT_KEY = "config.timeout"; + String CONFIG_APPNAME_KEY = "config.app-name"; + + String MULTICAST = "multicast"; + + + String DUBBO_IP_TO_REGISTRY = "DUBBO_IP_TO_REGISTRY"; + + String DUBBO_PORT_TO_REGISTRY = "DUBBO_PORT_TO_REGISTRY"; + + + String DUBBO_PORT_TO_BIND = "DUBBO_PORT_TO_BIND"; + + String SCOPE_NONE = "none"; + + + String ON_INVOKE_METHOD_KEY = "oninvoke.method"; + + String ON_RETURN_METHOD_KEY = "onreturn.method"; + + String ON_THROW_METHOD_KEY = "onthrow.method"; + + String ON_INVOKE_INSTANCE_KEY = "oninvoke.instance"; + + String ON_RETURN_INSTANCE_KEY = "onreturn.instance"; + + String ON_THROW_INSTANCE_KEY = "onthrow.instance"; + + + // FIXME: is this still useful? + String SHUTDOWN_TIMEOUT_KEY = "shutdown.timeout"; + + + String PROTOCOLS_SUFFIX = "dubbo.protocols."; + + + String REGISTRIES_SUFFIX = "dubbo.registries."; + +} diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java index c9dfdaa6d79..c942794d1c2 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/MethodConfig.java @@ -25,12 +25,12 @@ import java.util.Collections; import java.util.List; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_INVOKE_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_INVOKE_METHOD_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_RETURN_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_RETURN_METHOD_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_INVOKE_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_INVOKE_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_RETURN_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_RETURN_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_METHOD_KEY; /** * The method configuration diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ModuleConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ModuleConfig.java index 23b5743f6f7..1aecc549177 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ModuleConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ModuleConfig.java @@ -23,9 +23,9 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.dubbo.common.constants.ConfigConstants.NAME; -import static org.apache.dubbo.common.constants.ConfigConstants.ORGANIZATION; -import static org.apache.dubbo.common.constants.ConfigConstants.OWNER; +import static org.apache.dubbo.config.Constants.NAME; +import static org.apache.dubbo.config.Constants.ORGANIZATION; +import static org.apache.dubbo.config.Constants.OWNER; /** * The module info diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProtocolConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProtocolConfig.java index 73755984ae8..d957f1f1cda 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProtocolConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProtocolConfig.java @@ -35,7 +35,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PROTOCOL; import static org.apache.dubbo.common.constants.ConfigConstants.HOST_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.PROTOCOLS_SUFFIX; +import static org.apache.dubbo.config.Constants.PROTOCOLS_SUFFIX; import static org.apache.dubbo.common.constants.ConfigConstants.TELNET; import static org.apache.dubbo.common.constants.RpcConstants.DUBBO_VERSION_KEY; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProviderConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProviderConfig.java index c8c6380f571..3e75dfdd66c 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProviderConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ProviderConfig.java @@ -29,8 +29,8 @@ import java.util.Arrays; import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.CONTEXTPATH_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.STATUS_KEY; +import static org.apache.dubbo.config.Constants.CONTEXTPATH_KEY; +import static org.apache.dubbo.config.Constants.STATUS_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.TELNET; /** diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java index 51a8204c712..2d50ae596ee 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java @@ -66,7 +66,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.SEMICOLON_SPLIT_PATTERN; import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.CLUSTER_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_IP_TO_REGISTRY; +import static org.apache.dubbo.config.Constants.DUBBO_IP_TO_REGISTRY; import static org.apache.dubbo.common.constants.ConfigConstants.REFER_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.REGISTER_IP_KEY; import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java index 1d2109af22e..90a7fd97043 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/RegistryConfig.java @@ -25,7 +25,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.FILE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.PROTOCOL_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.PASSWORD_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.REGISTRIES_SUFFIX; +import static org.apache.dubbo.config.Constants.REGISTRIES_SUFFIX; import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.USERNAME_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.ZOOKEEPER_PROTOCOL; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java index 2a9ca02fdda..e70195d5407 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java @@ -72,15 +72,15 @@ import static org.apache.dubbo.common.constants.CommonConstants.REVISION_KEY; import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_IP_TO_BIND; -import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_IP_TO_REGISTRY; -import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PORT_TO_BIND; -import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PORT_TO_REGISTRY; +import static org.apache.dubbo.config.Constants.DUBBO_IP_TO_REGISTRY; +import static org.apache.dubbo.config.Constants.DUBBO_PORT_TO_BIND; +import static org.apache.dubbo.config.Constants.DUBBO_PORT_TO_REGISTRY; import static org.apache.dubbo.common.constants.ConfigConstants.EXPORT_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.MULTICAST; -import static org.apache.dubbo.common.constants.ConfigConstants.PROTOCOLS_SUFFIX; +import static org.apache.dubbo.config.Constants.MULTICAST; +import static org.apache.dubbo.config.Constants.PROTOCOLS_SUFFIX; import static org.apache.dubbo.common.constants.ConfigConstants.SCOPE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.SCOPE_LOCAL; -import static org.apache.dubbo.common.constants.ConfigConstants.SCOPE_NONE; +import static org.apache.dubbo.config.Constants.SCOPE_NONE; import static org.apache.dubbo.common.constants.ConfigConstants.SCOPE_REMOTE; import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY; import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_KEY; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java index 45992a4f516..7ab59a6bf8c 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/builders/ApplicationBuilder.java @@ -25,7 +25,7 @@ import java.util.List; import java.util.Map; -import static org.apache.dubbo.common.constants.ConfigConstants.PRODUCTION_ENVIRONMENT; +import static org.apache.dubbo.config.Constants.PRODUCTION_ENVIRONMENT; /** * This is a builder for build {@link ApplicationConfig}. diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java index e50caa1e3a5..c0e777bd637 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/MethodConfigTest.java @@ -17,7 +17,6 @@ package org.apache.dubbo.config; -import org.apache.dubbo.common.constants.ConfigConstants; import org.apache.dubbo.config.annotation.Argument; import org.apache.dubbo.config.annotation.Method; import org.apache.dubbo.config.annotation.Reference; @@ -30,11 +29,12 @@ import java.util.List; import java.util.Map; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_INVOKE_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_RETURN_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_RETURN_METHOD_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_INSTANCE_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_INVOKE_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_RETURN_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_RETURN_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_INSTANCE_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_INVOKE_METHOD_KEY; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; @@ -225,7 +225,7 @@ public void testOninvokeMethod() throws Exception { assertThat(method.getOninvokeMethod(), equalTo("on-invoke-method")); Map attribute = new HashMap(); MethodConfig.appendAttributes(attribute, method); - assertThat(attribute, hasEntry((Object) ConfigConstants.ON_INVOKE_METHOD_KEY, (Object) "on-invoke-method")); + assertThat(attribute, hasEntry((Object) ON_INVOKE_METHOD_KEY, (Object) "on-invoke-method")); Map parameters = new HashMap(); MethodConfig.appendParameters(parameters, method); assertThat(parameters.size(), is(0)); diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java index 70567fac1ec..9b3e0e75d63 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/RegistryConfigTest.java @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.Map; -import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_TIMEOUT_KEY; +import static org.apache.dubbo.config.Constants.SHUTDOWN_TIMEOUT_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java index b60bbfda398..e4361195e87 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/ServiceConfigTest.java @@ -48,7 +48,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER; import static org.apache.dubbo.common.constants.CommonConstants.SIDE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.EXPORT_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_TIMEOUT_KEY; +import static org.apache.dubbo.config.Constants.SHUTDOWN_TIMEOUT_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY; import static org.apache.dubbo.remoting.Constants.BIND_IP_KEY; import static org.apache.dubbo.remoting.Constants.BIND_PORT_KEY; diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/Constants.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/Constants.java index 9d86b5d0228..f8cc1cec27f 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/Constants.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/Constants.java @@ -62,4 +62,8 @@ public interface Constants { String OPTIMIZER_KEY = "optimizer"; + String ON_CONNECT_KEY = "onconnect"; + + String ON_DISCONNECT_KEY = "ondisconnect"; + } diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java index dad2f4e0fe4..e3c945b873f 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java @@ -63,8 +63,8 @@ import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY; import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.LAZY_CONNECT_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_CONNECT_KEY; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_DISCONNECT_KEY; +import static org.apache.dubbo.rpc.protocol.dubbo.Constants.ON_CONNECT_KEY; +import static org.apache.dubbo.rpc.protocol.dubbo.Constants.ON_DISCONNECT_KEY; import static org.apache.dubbo.common.constants.RemotingConstants.DEFAULT_HEARTBEAT; import static org.apache.dubbo.common.constants.RemotingConstants.HEARTBEAT_KEY; import static org.apache.dubbo.remoting.Constants.CHANNEL_READONLYEVENT_SENT_KEY; diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java index 39dc86187aa..2429b4b9580 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/test/java/org/apache/dubbo/rpc/protocol/dubbo/FutureFilterTest.java @@ -30,7 +30,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import static org.apache.dubbo.common.constants.ConfigConstants.ON_THROW_METHOD_KEY; +import static org.apache.dubbo.config.Constants.ON_THROW_METHOD_KEY; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock;