From 2c53c2adf264ae6114ea4249091b9364e975a130 Mon Sep 17 00:00:00 2001 From: Ian Luo Date: Wed, 15 May 2019 17:28:28 +0800 Subject: [PATCH] [DUBBO-3137]: step4 - remove ClusterConstants --- .../apache/dubbo/rpc/cluster/Configurator.java | 2 +- .../apache/dubbo/rpc/cluster/Constants.java | 14 ++++---------- .../configurator/AbstractConfigurator.java | 4 ++-- .../configurator/parser/ConfigParser.java | 2 +- .../loadbalance/AbstractLoadBalance.java | 10 +++++----- .../router/condition/ConditionRouter.java | 10 +++++----- .../cluster/router/file/FileRouterFactory.java | 8 ++++---- .../router/mock/MockInvokersSelector.java | 4 ++-- .../cluster/router/script/ScriptRouter.java | 12 ++++++------ .../rpc/cluster/router/tag/TagRouter.java | 18 +++++++++--------- .../support/AbstractClusterInvoker.java | 12 ++++++------ .../rpc/cluster/support/ClusterUtils.java | 2 +- .../support/FailbackClusterInvoker.java | 8 ++++---- .../support/FailoverClusterInvoker.java | 4 ++-- .../cluster/support/ForkingClusterInvoker.java | 4 ++-- .../support/wrapper/MockClusterInvoker.java | 2 +- .../apache/dubbo/rpc/cluster/StickyTest.java | 2 +- .../configurator/parser/ConfigParserTest.java | 6 +++--- .../cluster/directory/StaticDirectoryTest.java | 2 +- .../loadbalance/LoadBalanceBaseTest.java | 4 ++-- .../router/condition/ConditionRouterTest.java | 4 ++-- .../router/file/FileRouterEngineTest.java | 2 +- .../router/script/ScriptRouterTest.java | 2 +- .../support/AbstractClusterInvokerTest.java | 4 ++-- .../common/constants/RegistryConstants.java | 4 ++++ .../com/alibaba/dubbo/common/Constants.java | 5 ++--- .../dubbo/config/AbstractInterfaceConfig.java | 2 +- .../dubbo/config/AbstractMethodConfig.java | 2 +- .../dubbo/config/AbstractReferenceConfig.java | 2 +- .../dubbo/config/annotation/Reference.java | 8 ++++---- .../dubbo/config/annotation/Service.java | 10 +++++----- .../config/AbstractReferenceConfigTest.java | 2 +- .../config/spring/SimpleRegistryExporter.java | 2 +- .../integration/RegistryDirectory.java | 2 +- .../registry/integration/RegistryProtocol.java | 6 +++--- .../registry/dubbo/DubboRegistryFactory.java | 2 +- .../registry/dubbo/RegistryDirectoryTest.java | 12 ++++++------ .../registry/dubbo/SimpleRegistryExporter.java | 2 +- .../org/apache/dubbo/rpc/RpcConstants.java | 5 ++--- .../apache/dubbo/rpc/filter/ContextFilter.java | 2 +- 40 files changed, 103 insertions(+), 107 deletions(-) rename dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java => dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Constants.java (91%) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Configurator.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Configurator.java index dd6b4ba8d83..24e568375dc 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Configurator.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Configurator.java @@ -27,7 +27,7 @@ import java.util.Map; import java.util.Optional; -import static org.apache.dubbo.common.constants.ClusterConstants.PRIORITY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.PRIORITY_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_KEY; import static org.apache.dubbo.common.constants.RegistryConstants.EMPTY_PROTOCOL; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Constants.java similarity index 91% rename from dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java rename to dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Constants.java index 269fd75a340..8849c267145 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/Constants.java @@ -14,15 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.dubbo.rpc.cluster; -package org.apache.dubbo.common.constants; - -public interface ClusterConstants { - /** - * key for router type, for e.g., "script"/"file", corresponding to ScriptRouterFactory.NAME, FileRouterFactory.NAME - */ - String ROUTER_KEY = "router"; - +public interface Constants { String LOADBALANCE_KEY = "loadbalance"; String DEFAULT_LOADBALANCE = "random"; @@ -95,8 +89,6 @@ public interface ClusterConstants { String RUNTIME_KEY = "runtime"; - String TAG_KEY = "dubbo.tag"; - String REMOTE_TIMESTAMP_KEY = "remote.timestamp"; String WARMUP_KEY = "warmup"; @@ -106,4 +98,6 @@ public interface ClusterConstants { String CONFIG_VERSION_KEY = "configVersion"; String OVERRIDE_PROVIDERS_KEY = "providerAddresses"; + + String TAG_KEY = "dubbo.tag"; } diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java index 84275aef9a7..315968e67c8 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/AbstractConfigurator.java @@ -26,8 +26,8 @@ import java.util.Map; import java.util.Set; -import static org.apache.dubbo.common.constants.ClusterConstants.CONFIG_VERSION_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.OVERRIDE_PROVIDERS_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CONFIG_VERSION_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.OVERRIDE_PROVIDERS_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY; diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java index 5b6f457b14f..349c9f68e8a 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParser.java @@ -30,7 +30,7 @@ import java.util.List; import java.util.Map; -import static org.apache.dubbo.common.constants.ClusterConstants.OVERRIDE_PROVIDERS_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.OVERRIDE_PROVIDERS_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE; import static org.apache.dubbo.common.constants.RegistryConstants.APP_DYNAMIC_CONFIGURATORS_CATEGORY; import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_CONFIGURATORS_CATEGORY; diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java index 9ca40e37617..ed6f3c4e985 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java @@ -24,11 +24,11 @@ import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_WARMUP; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_WEIGHT; -import static org.apache.dubbo.common.constants.ClusterConstants.REMOTE_TIMESTAMP_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.WARMUP_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.WEIGHT_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_WARMUP; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_WEIGHT; +import static org.apache.dubbo.rpc.cluster.Constants.REMOTE_TIMESTAMP_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.WARMUP_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.WEIGHT_KEY; /** * AbstractLoadBalance diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java index f69b1854fda..5fe82025460 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouter.java @@ -38,11 +38,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import static org.apache.dubbo.common.constants.ClusterConstants.ADDRESS_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.FORCE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.PRIORITY_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RUNTIME_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.ADDRESS_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.PRIORITY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RUNTIME_KEY; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY_PREFIX; import static org.apache.dubbo.common.constants.CommonConstants.ENABLED_KEY; import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY; diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterFactory.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterFactory.java index 7ad7fc7f897..13e929c6121 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterFactory.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterFactory.java @@ -27,10 +27,10 @@ import java.io.FileReader; import java.io.IOException; -import static org.apache.dubbo.common.constants.ClusterConstants.ROUTER_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RUNTIME_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.TYPE_KEY; +import static org.apache.dubbo.common.constants.RegistryConstants.ROUTER_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RUNTIME_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.TYPE_KEY; public class FileRouterFactory implements RouterFactory { diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelector.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelector.java index 76fa6ded425..c20c5f3abd7 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelector.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/mock/MockInvokersSelector.java @@ -26,8 +26,8 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.INVOCATION_NEED_MOCK; -import static org.apache.dubbo.common.constants.ClusterConstants.MOCK_PROTOCOL; +import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK; +import static org.apache.dubbo.rpc.cluster.Constants.MOCK_PROTOCOL; /** * A specific Router designed to realize mock feature. diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouter.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouter.java index c73d9a9ec13..8d66a9e7b38 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouter.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouter.java @@ -39,12 +39,12 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_SCRIPT_TYPE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.FORCE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.PRIORITY_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RUNTIME_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.TYPE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_SCRIPT_TYPE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.PRIORITY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RUNTIME_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.TYPE_KEY; /** * ScriptRouter diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java index 67ab112330f..d4cf9dfd5b4 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/router/tag/TagRouter.java @@ -17,7 +17,6 @@ package org.apache.dubbo.rpc.cluster.router.tag; import org.apache.dubbo.common.URL; -import org.apache.dubbo.common.constants.ClusterConstants; import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.logger.Logger; import org.apache.dubbo.common.logger.LoggerFactory; @@ -31,6 +30,7 @@ import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.RpcException; +import org.apache.dubbo.rpc.cluster.Constants; import org.apache.dubbo.rpc.cluster.router.AbstractRouter; import org.apache.dubbo.rpc.cluster.router.tag.model.TagRouterRule; import org.apache.dubbo.rpc.cluster.router.tag.model.TagRuleParser; @@ -40,7 +40,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; -import static org.apache.dubbo.common.constants.ClusterConstants.TAG_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.TAG_KEY; import static org.apache.dubbo.common.constants.RpcConstants.FORCE_USE_TAG; /** @@ -97,8 +97,8 @@ public List> route(List> invokers, URL url, Invocation } List> result = invokers; - String tag = StringUtils.isEmpty(invocation.getAttachment(ClusterConstants.TAG_KEY)) ? url.getParameter(ClusterConstants.TAG_KEY) : - invocation.getAttachment(ClusterConstants.TAG_KEY); + String tag = StringUtils.isEmpty(invocation.getAttachment(Constants.TAG_KEY)) ? url.getParameter(Constants.TAG_KEY) : + invocation.getAttachment(Constants.TAG_KEY); // if we are requesting for a Provider with a specific tag if (StringUtils.isNotEmpty(tag)) { @@ -113,7 +113,7 @@ public List> route(List> invokers, URL url, Invocation } else { // dynamic tag group doesn't have any item about the requested app OR it's null after filtered by // dynamic tag group but force=false. check static tag - result = filterInvoker(invokers, invoker -> tag.equals(invoker.getUrl().getParameter(ClusterConstants.TAG_KEY))); + result = filterInvoker(invokers, invoker -> tag.equals(invoker.getUrl().getParameter(Constants.TAG_KEY))); } // If there's no tagged providers that can match the current tagged request. force.tag is set by default // to false, which means it will invoke any providers without a tag unless it's explicitly disallowed. @@ -124,7 +124,7 @@ public List> route(List> invokers, URL url, Invocation else { List> tmp = filterInvoker(invokers, invoker -> addressNotMatches(invoker.getUrl(), tagRouterRuleCopy.getAddresses())); - return filterInvoker(tmp, invoker -> StringUtils.isEmpty(invoker.getUrl().getParameter(ClusterConstants.TAG_KEY))); + return filterInvoker(tmp, invoker -> StringUtils.isEmpty(invoker.getUrl().getParameter(Constants.TAG_KEY))); } } else { // List addresses = tagRouterRule.filter(providerApp); @@ -140,7 +140,7 @@ public List> route(List> invokers, URL url, Invocation // static tag group. } return filterInvoker(result, invoker -> { - String localTag = invoker.getUrl().getParameter(ClusterConstants.TAG_KEY); + String localTag = invoker.getUrl().getParameter(Constants.TAG_KEY); return StringUtils.isEmpty(localTag) || !tagRouterRuleCopy.getTagNames().contains(localTag); }); } @@ -163,8 +163,8 @@ public List> route(List> invokers, URL url, Invocation private List> filterUsingStaticTag(List> invokers, URL url, Invocation invocation) { List> result = invokers; // Dynamic param - String tag = StringUtils.isEmpty(invocation.getAttachment(ClusterConstants.TAG_KEY)) ? url.getParameter(ClusterConstants.TAG_KEY) : - invocation.getAttachment(ClusterConstants.TAG_KEY); + String tag = StringUtils.isEmpty(invocation.getAttachment(Constants.TAG_KEY)) ? url.getParameter(Constants.TAG_KEY) : + invocation.getAttachment(Constants.TAG_KEY); // Tag request if (!StringUtils.isEmpty(tag)) { result = filterInvoker(invokers, invoker -> tag.equals(invoker.getUrl().getParameter(TAG_KEY))); diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java index 922f4dc97df..db2d401eba9 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvoker.java @@ -39,12 +39,12 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_AVAILABLE_CHECK_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_CLUSTER_AVAILABLE_CHECK; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_CLUSTER_STICKY; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_LOADBALANCE; -import static org.apache.dubbo.common.constants.ClusterConstants.LOADBALANCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_AVAILABLE_CHECK_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_CLUSTER_AVAILABLE_CHECK; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_CLUSTER_STICKY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_LOADBALANCE; +import static org.apache.dubbo.rpc.cluster.Constants.LOADBALANCE_KEY; /** * AbstractClusterInvoker diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java index a3418adb845..93d2b6bcad9 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ClusterUtils.java @@ -23,7 +23,7 @@ import java.util.HashMap; import java.util.Map; -import static org.apache.dubbo.common.constants.ClusterConstants.TAG_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.TAG_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ALIVE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY; import static org.apache.dubbo.common.constants.CommonConstants.CORE_THREADS_KEY; diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java index f4ad2ad25dd..a17c4abcbd2 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailbackClusterInvoker.java @@ -35,10 +35,10 @@ import java.util.List; import java.util.concurrent.TimeUnit; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_FAILBACK_TIMES; -import static org.apache.dubbo.common.constants.ClusterConstants.RETRIES_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_FAILBACK_TASKS; -import static org.apache.dubbo.common.constants.ClusterConstants.FAIL_BACK_TASKS_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_FAILBACK_TIMES; +import static org.apache.dubbo.rpc.cluster.Constants.RETRIES_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_FAILBACK_TASKS; +import static org.apache.dubbo.rpc.cluster.Constants.FAIL_BACK_TASKS_KEY; /** * When fails, record failure requests and schedule for retry on a regular interval. diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java index bb3fecdeb70..77254470b5d 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/FailoverClusterInvoker.java @@ -34,8 +34,8 @@ import java.util.List; import java.util.Set; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_RETRIES; -import static org.apache.dubbo.common.constants.ClusterConstants.RETRIES_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_RETRIES; +import static org.apache.dubbo.rpc.cluster.Constants.RETRIES_KEY; /** * When invoke fails, log the initial error and retry other invokers (retry n times, which means at most n different invokers will be invoked) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java index bb44b0bd0f9..70a6eaa75ff 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java @@ -34,8 +34,8 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_FORKS; -import static org.apache.dubbo.common.constants.ClusterConstants.FORKS_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_FORKS; +import static org.apache.dubbo.rpc.cluster.Constants.FORKS_KEY; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT; import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY; diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java index d2db9192533..c9e7ac6ed1c 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/wrapper/MockClusterInvoker.java @@ -32,7 +32,7 @@ import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.INVOCATION_NEED_MOCK; +import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK; import static org.apache.dubbo.common.constants.RpcConstants.MOCK_KEY; public class MockClusterInvoker implements Invoker { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java index 6b093b97d59..878e3742df6 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/StickyTest.java @@ -34,7 +34,7 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java index 9f4eb1b69a0..364a813ddc1 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/configurator/parser/ConfigParserTest.java @@ -30,9 +30,9 @@ import java.io.InputStream; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.LOADBALANCE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.OVERRIDE_PROVIDERS_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.WEIGHT_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.LOADBALANCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.OVERRIDE_PROVIDERS_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.WEIGHT_KEY; import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY; import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY; import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java index 03e611ec1eb..7ce8f4ae941 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/directory/StaticDirectoryTest.java @@ -30,7 +30,7 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; /** * StaticDirectory Test diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java index 47419fdd8de..fef733ae7af 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LoadBalanceBaseTest.java @@ -37,8 +37,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_WARMUP; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_WEIGHT; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_WARMUP; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_WEIGHT; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouterTest.java index eb3d28db75c..bf378f0c214 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/condition/ConditionRouterTest.java @@ -33,8 +33,8 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.FORCE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.FORCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; public class ConditionRouterTest { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java index ef7c37b2edc..635014863b1 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/file/FileRouterEngineTest.java @@ -40,7 +40,7 @@ import java.util.Arrays; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.RUNTIME_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RUNTIME_KEY; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.mock; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouterTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouterTest.java index 29b29d1a7d3..f52347f0b85 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouterTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/router/script/ScriptRouterTest.java @@ -31,7 +31,7 @@ import java.util.ArrayList; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; public class ScriptRouterTest { diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java index 6f0b37b7c8f..de191d757ea 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/AbstractClusterInvokerTest.java @@ -47,8 +47,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_AVAILABLE_CHECK_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.INVOCATION_NEED_MOCK; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_AVAILABLE_CHECK_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK; import static org.apache.dubbo.common.constants.ConfigConstants.REFER_KEY; import static org.apache.dubbo.common.constants.MonitorConstants.MONITOR_KEY; import static org.mockito.BDDMockito.given; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java index d8bf70139f7..d04856f81a1 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java @@ -129,4 +129,8 @@ public interface RegistryConstants { String SESSION_TIMEOUT_KEY = "session"; int DEFAULT_SESSION_TIMEOUT = 60 * 1000; + /** + * key for router type, for e.g., "script"/"file", corresponding to ScriptRouterFactory.NAME, FileRouterFactory.NAME + */ + String ROUTER_KEY = "router"; } diff --git a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java index b862f9e7e78..f447d2967f5 100644 --- a/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java +++ b/dubbo-compatible/src/main/java/com/alibaba/dubbo/common/Constants.java @@ -17,7 +17,6 @@ package com.alibaba.dubbo.common; -import org.apache.dubbo.common.constants.ClusterConstants; import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.constants.ConfigConstants; import org.apache.dubbo.common.constants.FilterConstants; @@ -27,6 +26,6 @@ import org.apache.dubbo.common.constants.RpcConstants; @Deprecated -public class Constants implements ClusterConstants, CommonConstants, ConfigConstants, FilterConstants, - MonitorConstants, RegistryConstants, RemotingConstants, RpcConstants { +public class Constants implements CommonConstants, ConfigConstants, FilterConstants, + MonitorConstants, RegistryConstants, RemotingConstants, RpcConstants, org.apache.dubbo.rpc.cluster.Constants { } 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 cd04ac85d22..d0bcb4ddd68 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 @@ -53,7 +53,7 @@ import java.util.Set; import static org.apache.dubbo.common.config.ConfigurationUtils.parseProperties; -import static org.apache.dubbo.common.constants.ClusterConstants.TAG_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.TAG_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SEPARATOR; import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractMethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractMethodConfig.java index d6d0086c5dd..42e4ca90ef2 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractMethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractMethodConfig.java @@ -21,7 +21,7 @@ import java.util.Map; -import static org.apache.dubbo.common.constants.ClusterConstants.LOADBALANCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.LOADBALANCE_KEY; import static org.apache.dubbo.common.constants.RpcConstants.FAIL_PREFIX; import static org.apache.dubbo.common.constants.RpcConstants.FORCE_PREFIX; import static org.apache.dubbo.common.constants.RpcConstants.MOCK_KEY; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java index 80409f23d05..7fe8dc4fae2 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/AbstractReferenceConfig.java @@ -21,7 +21,7 @@ import org.apache.dubbo.rpc.InvokerListener; import org.apache.dubbo.rpc.support.ProtocolUtils; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY; import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.LAZY_CONNECT_KEY; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Reference.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Reference.java index 9ad68c1d73c..d6e93441fd0 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Reference.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Reference.java @@ -16,11 +16,11 @@ */ package org.apache.dubbo.config.annotation; -import org.apache.dubbo.common.constants.ClusterConstants; import org.apache.dubbo.common.constants.RemotingConstants; import org.apache.dubbo.common.constants.RpcConstants; import org.apache.dubbo.rpc.ExporterListener; import org.apache.dubbo.rpc.Filter; +import org.apache.dubbo.rpc.cluster.Constants; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -110,7 +110,7 @@ /** * Whether to stick to the same node in the cluster, the default value is false * - * @see ClusterConstants#DEFAULT_CLUSTER_STICKY + * @see Constants#DEFAULT_CLUSTER_STICKY */ boolean sticky() default false; @@ -164,14 +164,14 @@ /** * Service invocation retry times * - * @see ClusterConstants#DEFAULT_RETRIES + * @see Constants#DEFAULT_RETRIES */ int retries() default 2; /** * Load balance strategy, legal values include: random, roundrobin, leastactive * - * @see ClusterConstants#DEFAULT_LOADBALANCE + * @see Constants#DEFAULT_LOADBALANCE */ String loadbalance() default ""; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Service.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Service.java index 560547102b5..f743386f139 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Service.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/annotation/Service.java @@ -16,10 +16,10 @@ */ package org.apache.dubbo.config.annotation; -import org.apache.dubbo.common.constants.ClusterConstants; import org.apache.dubbo.common.constants.RpcConstants; import org.apache.dubbo.rpc.ExporterListener; import org.apache.dubbo.rpc.Filter; +import org.apache.dubbo.rpc.cluster.Constants; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; @@ -28,8 +28,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_LOADBALANCE; -import static org.apache.dubbo.common.constants.ClusterConstants.DEFAULT_RETRIES; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_LOADBALANCE; +import static org.apache.dubbo.rpc.cluster.Constants.DEFAULT_RETRIES; /** * Service annotation @@ -173,14 +173,14 @@ /** * Service invocation retry times * - * @see ClusterConstants#DEFAULT_RETRIES + * @see Constants#DEFAULT_RETRIES */ int retries() default DEFAULT_RETRIES; /** * Load balance strategy, legal values include: random, roundrobin, leastactive * - * @see ClusterConstants#DEFAULT_LOADBALANCE + * @see Constants#DEFAULT_LOADBALANCE */ String loadbalance() default DEFAULT_LOADBALANCE; diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java index 63683895160..ab40eb1d53f 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractReferenceConfigTest.java @@ -24,7 +24,7 @@ import java.util.HashMap; import java.util.Map; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; import static org.apache.dubbo.common.constants.RpcConstants.INVOKER_LISTENER_KEY; import static org.apache.dubbo.common.constants.RpcConstants.REFERENCE_FILTER_KEY; import static org.apache.dubbo.common.constants.RpcConstants.STUB_EVENT_KEY; diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/SimpleRegistryExporter.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/SimpleRegistryExporter.java index 4f7ea52c455..38f57abc330 100644 --- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/SimpleRegistryExporter.java +++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/SimpleRegistryExporter.java @@ -27,7 +27,7 @@ import java.io.IOException; import java.net.ServerSocket; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PROTOCOL; import static org.apache.dubbo.common.constants.RpcConstants.CALLBACK_INSTANCES_LIMIT_KEY; diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java index 327b5c029de..20c8b09a4d3 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java @@ -58,7 +58,7 @@ import java.util.Set; import java.util.stream.Collectors; -import static org.apache.dubbo.common.constants.ClusterConstants.ROUTER_KEY; +import static org.apache.dubbo.common.constants.RegistryConstants.ROUTER_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY; import static org.apache.dubbo.common.constants.CommonConstants.DISABLED_KEY; diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java index 69173d9121c..780d4bc12e5 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryProtocol.java @@ -52,9 +52,9 @@ import java.util.concurrent.ExecutorService; import static java.util.concurrent.Executors.newSingleThreadExecutor; -import static org.apache.dubbo.common.constants.ClusterConstants.LOADBALANCE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.WARMUP_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.WEIGHT_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.LOADBALANCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.WARMUP_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.WEIGHT_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANY_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY; import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN; diff --git a/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistryFactory.java b/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistryFactory.java index 5a3f6ab5655..1728e146e3f 100644 --- a/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistryFactory.java +++ b/dubbo-registry/dubbo-registry-default/src/main/java/org/apache/dubbo/registry/dubbo/DubboRegistryFactory.java @@ -36,7 +36,7 @@ import java.util.HashSet; import java.util.List; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN; import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY; diff --git a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java index 77616c4912a..b3cb0de7b86 100644 --- a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java +++ b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/RegistryDirectoryTest.java @@ -49,12 +49,12 @@ import java.util.Map; import java.util.concurrent.CountDownLatch; -import static org.apache.dubbo.common.constants.ClusterConstants.INVOCATION_NEED_MOCK; -import static org.apache.dubbo.common.constants.ClusterConstants.LOADBALANCE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.MOCK_PROTOCOL; -import static org.apache.dubbo.common.constants.ClusterConstants.ROUTER_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.RULE_KEY; -import static org.apache.dubbo.common.constants.ClusterConstants.TYPE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK; +import static org.apache.dubbo.rpc.cluster.Constants.LOADBALANCE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.MOCK_PROTOCOL; +import static org.apache.dubbo.common.constants.RegistryConstants.ROUTER_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.RULE_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.TYPE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE; import static org.apache.dubbo.common.constants.CommonConstants.APPLICATION_KEY; import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE; diff --git a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/SimpleRegistryExporter.java b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/SimpleRegistryExporter.java index d07c815df9e..785cf528858 100644 --- a/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/SimpleRegistryExporter.java +++ b/dubbo-registry/dubbo-registry-default/src/test/java/org/apache/dubbo/registry/dubbo/SimpleRegistryExporter.java @@ -27,7 +27,7 @@ import java.io.IOException; import java.net.ServerSocket; -import static org.apache.dubbo.common.constants.ClusterConstants.CLUSTER_STICKY_KEY; +import static org.apache.dubbo.rpc.cluster.Constants.CLUSTER_STICKY_KEY; import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.common.constants.ConfigConstants.DUBBO_PROTOCOL; import static org.apache.dubbo.common.constants.RpcConstants.CALLBACK_INSTANCES_LIMIT_KEY; diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcConstants.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcConstants.java index 7d592b1c762..8a3b60dfe14 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcConstants.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcConstants.java @@ -16,7 +16,6 @@ */ package org.apache.dubbo.rpc; -import org.apache.dubbo.common.constants.ClusterConstants; import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.constants.ConfigConstants; import org.apache.dubbo.common.constants.FilterConstants; @@ -30,8 +29,8 @@ * @deprecated Replace to org.apache.dubbo.common.Constants */ @Deprecated -public final class RpcConstants implements ClusterConstants, CommonConstants, ConfigConstants, FilterConstants, - MonitorConstants, RegistryConstants, RemotingConstants, org.apache.dubbo.common.constants.RpcConstants { +public final class RpcConstants implements CommonConstants, ConfigConstants, FilterConstants, MonitorConstants, + RegistryConstants, RemotingConstants, org.apache.dubbo.common.constants.RpcConstants { private RpcConstants() { } diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java index 99596bf025b..1d04b8a090c 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/filter/ContextFilter.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.Map; -import static org.apache.dubbo.common.constants.ClusterConstants.TAG_KEY; import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY; import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY; import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY; @@ -50,6 +49,7 @@ */ @Activate(group = PROVIDER, order = -10000) public class ContextFilter implements Filter { + private static final String TAG_KEY = "dubbo.tag"; @Override public Result invoke(Invoker invoker, Invocation invocation) throws RpcException {