This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 951ad36 Solve #3137, step 2, seperate constants for cluster, common,
filter, monitor, and registry (#4020)
951ad36 is described below
commit 951ad3687adf286e6d483ee833ecfb1e8151d669
Author: Ian Luo <[email protected]>
AuthorDate: Fri May 10 15:50:08 2019 +0800
Solve #3137, step 2, seperate constants for cluster, common, filter,
monitor, and registry (#4020)
---
.../dubbo/common/constants/ClusterConstants.java | 109 ++++++++++++++
.../dubbo/common/constants/CommonConstants.java | 160 +++++++++++++++++++++
.../dubbo/common/constants/FilterConstants.java | 24 ++++
.../common/constants/MetadataReportConstants.java | 36 +++++
.../dubbo/common/constants/MonitorConstants.java | 46 ++++++
.../dubbo/common/constants/RegistryConstants.java | 157 ++++++++++++++++++++
6 files changed, 532 insertions(+)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java
new file mode 100644
index 0000000..269fd75
--- /dev/null
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ClusterConstants.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+public interface ClusterConstants {
+ /**
+ * key for router type, for e.g., "script"/"file", corresponding to
ScriptRouterFactory.NAME, FileRouterFactory.NAME
+ */
+ String ROUTER_KEY = "router";
+
+ String LOADBALANCE_KEY = "loadbalance";
+
+ String DEFAULT_LOADBALANCE = "random";
+
+ String FAIL_BACK_TASKS_KEY = "failbacktasks";
+
+ int DEFAULT_FAILBACK_TASKS = 100;
+
+ String RETRIES_KEY = "retries";
+
+ int DEFAULT_RETRIES = 2;
+
+ int DEFAULT_FAILBACK_TIMES = 3;
+
+ String FORKS_KEY = "forks";
+
+ int DEFAULT_FORKS = 2;
+
+ String WEIGHT_KEY = "weight";
+
+ int DEFAULT_WEIGHT = 100;
+
+ String MOCK_PROTOCOL = "mock";
+
+ String FORCE_KEY = "force";
+
+ /**
+ * To decide whether to exclude unavailable invoker from the cluster
+ */
+ String CLUSTER_AVAILABLE_CHECK_KEY = "cluster.availablecheck";
+
+ /**
+ * The default value of cluster.availablecheck
+ *
+ * @see #CLUSTER_AVAILABLE_CHECK_KEY
+ */
+ boolean DEFAULT_CLUSTER_AVAILABLE_CHECK = true;
+
+ /**
+ * To decide whether to enable sticky strategy for cluster
+ */
+ String CLUSTER_STICKY_KEY = "sticky";
+
+ /**
+ * The default value of sticky
+ *
+ * @see #CLUSTER_STICKY_KEY
+ */
+ boolean DEFAULT_CLUSTER_STICKY = false;
+
+ String ADDRESS_KEY = "address";
+
+ /**
+ * When this attribute appears in invocation's attachment, mock invoker
will be used
+ */
+ String INVOCATION_NEED_MOCK = "invocation.need.mock";
+
+ /**
+ * when ROUTER_KEY's value is set to ROUTER_TYPE_CLEAR, RegistryDirectory
will clean all current routers
+ */
+ String ROUTER_TYPE_CLEAR = "clean";
+
+ String DEFAULT_SCRIPT_TYPE_KEY = "javascript";
+
+ String PRIORITY_KEY = "priority";
+
+ String RULE_KEY = "rule";
+
+ String TYPE_KEY = "type";
+
+ String RUNTIME_KEY = "runtime";
+
+ String TAG_KEY = "dubbo.tag";
+
+ String REMOTE_TIMESTAMP_KEY = "remote.timestamp";
+
+ String WARMUP_KEY = "warmup";
+
+ int DEFAULT_WARMUP = 10 * 60 * 1000;
+
+ String CONFIG_VERSION_KEY = "configVersion";
+
+ String OVERRIDE_PROVIDERS_KEY = "providerAddresses";
+}
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
new file mode 100644
index 0000000..3ce4f83
--- /dev/null
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/CommonConstants.java
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+import java.util.regex.Pattern;
+
+public interface CommonConstants {
+ String DUBBO = "dubbo";
+
+ String PROVIDER = "provider";
+
+ String CONSUMER = "consumer";
+
+ String APPLICATION_KEY = "application";
+
+ String REMOTE_APPLICATION_KEY = "remote.application";
+
+ String ENABLED_KEY = "enabled";
+
+ String DISABLED_KEY = "disabled";
+
+ String DUBBO_PROPERTIES_KEY = "dubbo.properties.file";
+
+ String DEFAULT_DUBBO_PROPERTIES = "dubbo.properties";
+
+ String ANY_VALUE = "*";
+
+ String COMMA_SEPARATOR = ",";
+
+ Pattern COMMA_SPLIT_PATTERN = Pattern.compile("\\s*[,]+\\s*");
+
+ public final static String PATH_SEPARATOR = "/";
+
+ public final static String PROTOCOL_SEPARATOR = "://";
+
+ String REGISTRY_SEPARATOR = "|";
+
+ Pattern REGISTRY_SPLIT_PATTERN = Pattern.compile("\\s*[|;]+\\s*");
+
+ String SEMICOLON_SEPARATOR = ";";
+
+ Pattern SEMICOLON_SPLIT_PATTERN = Pattern.compile("\\s*[;]+\\s*");
+
+ String DEFAULT_PROXY = "javassist";
+
+ String DEFAULT_DIRECTORY = "dubbo";
+
+ String PROTOCOL_KEY = "protocol";
+
+ String DEFAULT_PROTOCOL = "dubbo";
+
+ String DEFAULT_THREAD_NAME = "Dubbo";
+
+ int DEFAULT_CORE_THREADS = 0;
+
+ int DEFAULT_THREADS = 200;
+
+ String THREADPOOL_KEY = "threadpool";
+
+ String THREAD_NAME_KEY = "threadname";
+
+ String CORE_THREADS_KEY = "corethreads";
+
+ String THREADS_KEY = "threads";
+
+ String QUEUES_KEY = "queues";
+
+ String ALIVE_KEY = "alive";
+
+ String DEFAULT_THREADPOOL = "limited";
+
+ String DEFAULT_CLIENT_THREADPOOL = "cached";
+
+ String IO_THREADS_KEY = "iothreads";
+
+ int DEFAULT_QUEUES = 0;
+
+ int DEFAULT_ALIVE = 60 * 1000;
+
+ String TIMEOUT_KEY = "timeout";
+
+ int DEFAULT_TIMEOUT = 1000;
+
+ String REMOVE_VALUE_PREFIX = "-";
+
+ String PROPERTIES_CHAR_SEPERATOR = "-";
+
+ String GROUP_CHAR_SEPERATOR = ":";
+
+ String HIDE_KEY_PREFIX = ".";
+
+ String DEFAULT_KEY_PREFIX = "default.";
+
+ String DEFAULT_KEY = "default";
+
+ /**
+ * Default timeout value in milliseconds for server shutdown
+ */
+ int DEFAULT_SERVER_SHUTDOWN_TIMEOUT = 10000;
+
+ String SIDE_KEY = "side";
+
+ String PROVIDER_SIDE = "provider";
+
+ String CONSUMER_SIDE = "consumer";
+
+ String ANYHOST_KEY = "anyhost";
+
+ String ANYHOST_VALUE = "0.0.0.0";
+
+ String LOCALHOST_KEY = "localhost";
+
+ String LOCALHOST_VALUE = "127.0.0.1";
+
+ String METHODS_KEY = "methods";
+
+ String METHOD_KEY = "method";
+
+ String PID_KEY = "pid";
+
+ String TIMESTAMP_KEY = "timestamp";
+
+ String GROUP_KEY = "group";
+
+ String PATH_KEY = "path";
+
+ String INTERFACE_KEY = "interface";
+
+ String FILE_KEY = "file";
+
+ String DUMP_DIRECTORY = "dump.directory";
+
+ String CLASSIFIER_KEY = "classifier";
+
+ String VERSION_KEY = "version";
+
+ String REVISION_KEY = "revision";
+
+ /**
+ * package version in the manifest
+ */
+ String RELEASE_KEY = "release";
+
+ int MAX_PROXY_COUNT = 65535;
+}
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/FilterConstants.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/FilterConstants.java
new file mode 100644
index 0000000..f4199ff
--- /dev/null
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/FilterConstants.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+public interface FilterConstants {
+ String CACHE_KEY = "cache";
+
+ String VALIDATION_KEY = "validation";
+}
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/MetadataReportConstants.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/MetadataReportConstants.java
new file mode 100644
index 0000000..ee1119d
--- /dev/null
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/MetadataReportConstants.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+public interface MetadataReportConstants {
+ String METADATA_REPORT_KEY = "metadata";
+
+ String RETRY_TIMES_KEY = "retry.times";
+
+ Integer DEFAULT_METADATA_REPORT_RETRY_TIMES = 100;
+
+ String RETRY_PERIOD_KEY = "retry.period";
+
+ Integer DEFAULT_METADATA_REPORT_RETRY_PERIOD = 3000;
+
+ String SYNC_REPORT_KEY = "sync.report";
+
+ String CYCLE_REPORT_KEY = "cycle.report";
+
+ Boolean DEFAULT_METADATA_REPORT_CYCLE_REPORT = true;
+}
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/MonitorConstants.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/MonitorConstants.java
new file mode 100644
index 0000000..94079bf
--- /dev/null
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/MonitorConstants.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+public interface MonitorConstants {
+ String MONITOR_KEY = "monitor";
+
+ String LOGSTAT_PROTOCOL = "logstat";
+
+ String COUNT_PROTOCOL = "count";
+
+ String DUBBO_PROVIDER = "dubbo.provider";
+
+ String DUBBO_CONSUMER = "dubbo.consumer";
+
+ String DUBBO_PROVIDER_METHOD = "dubbo.provider.method";
+
+ String DUBBO_CONSUMER_METHOD = "dubbo.consumer.method";
+
+ String SERVICE = "service";
+
+ String METHOD = "method";
+
+ String DUBBO_GROUP = "dubbo";
+
+ String METRICS_KEY = "metrics";
+
+ String METRICS_PORT = "metrics.port";
+
+ String METRICS_PROTOCOL = "metrics.protocol";
+}
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
new file mode 100644
index 0000000..bcfc9dc
--- /dev/null
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RegistryConstants.java
@@ -0,0 +1,157 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dubbo.common.constants;
+
+import static org.apache.dubbo.common.Constants.APPLICATION_KEY;
+import static org.apache.dubbo.common.Constants.CLUSTER_KEY;
+import static org.apache.dubbo.common.Constants.CODEC_KEY;
+import static org.apache.dubbo.common.Constants.CONNECTIONS_KEY;
+import static org.apache.dubbo.common.Constants.DEPRECATED_KEY;
+import static org.apache.dubbo.common.Constants.DUBBO_VERSION_KEY;
+import static org.apache.dubbo.common.Constants.EXCHANGER_KEY;
+import static org.apache.dubbo.common.Constants.GROUP_KEY;
+import static org.apache.dubbo.common.Constants.LOADBALANCE_KEY;
+import static org.apache.dubbo.common.Constants.MOCK_KEY;
+import static org.apache.dubbo.common.Constants.PATH_KEY;
+import static org.apache.dubbo.common.Constants.RELEASE_KEY;
+import static org.apache.dubbo.common.Constants.SERIALIZATION_KEY;
+import static org.apache.dubbo.common.Constants.TIMEOUT_KEY;
+import static org.apache.dubbo.common.Constants.TIMESTAMP_KEY;
+import static org.apache.dubbo.common.Constants.TOKEN_KEY;
+import static org.apache.dubbo.common.Constants.VERSION_KEY;
+import static org.apache.dubbo.common.Constants.WARMUP_KEY;
+import static org.apache.dubbo.common.Constants.WEIGHT_KEY;
+
+public interface RegistryConstants {
+ String REGISTER_KEY = "register";
+
+ String SUBSCRIBE_KEY = "subscribe";
+
+ String REGISTRY_KEY = "registry";
+
+ String DEFAULT_REGISTRY = "dubbo";
+
+ String REGISTRY_PROTOCOL = "registry";
+
+ String DYNAMIC_KEY = "dynamic";
+
+ String REGISTER = "register";
+
+ String UNREGISTER = "unregister";
+
+ String SUBSCRIBE = "subscribe";
+
+ String UNSUBSCRIBE = "unsubscribe";
+
+ String CATEGORY_KEY = "category";
+
+ String PROVIDERS_CATEGORY = "providers";
+
+ String CONSUMERS_CATEGORY = "consumers";
+
+ String ROUTERS_CATEGORY = "routers";
+
+ String DYNAMIC_ROUTERS_CATEGORY = "dynamicrouters";
+
+ String DEFAULT_CATEGORY = PROVIDERS_CATEGORY;
+
+ String CONFIGURATORS_CATEGORY = "configurators";
+
+ String DYNAMIC_CONFIGURATORS_CATEGORY = "dynamicconfigurators";
+
+ String APP_DYNAMIC_CONFIGURATORS_CATEGORY = "appdynamicconfigurators";
+
+ String CONFIGURATORS_SUFFIX = ".configurators";
+
+ String ROUTERS_SUFFIX = ".routers";
+
+ String TRACE_PROTOCOL = "trace";
+
+ String EMPTY_PROTOCOL = "empty";
+
+ String ADMIN_PROTOCOL = "admin";
+
+ String PROVIDER_PROTOCOL = "provider";
+
+ String CONSUMER_PROTOCOL = "consumer";
+
+ String ROUTE_PROTOCOL = "route";
+
+ String SCRIPT_PROTOCOL = "script";
+
+ String CONDITION_PROTOCOL = "condition";
+
+ /**
+ * simple the registry for provider.
+ *
+ * @since 2.7.0
+ */
+ String SIMPLIFIED_KEY = "simplified";
+
+ /**
+ * After simplify the registry, should add some paramter individually for
provider.
+ *
+ * @since 2.7.0
+ */
+ String EXTRA_KEYS_KEY = "extra-keys";
+
+ String OVERRIDE_PROTOCOL = "override";
+
+ String COMPATIBLE_CONFIG_KEY = "compatible_config";
+
+ String[] DEFAULT_REGISTER_PROVIDER_KEYS = {APPLICATION_KEY, CODEC_KEY,
EXCHANGER_KEY, SERIALIZATION_KEY, CLUSTER_KEY, CONNECTIONS_KEY, DEPRECATED_KEY,
+ GROUP_KEY, LOADBALANCE_KEY, MOCK_KEY, PATH_KEY, TIMEOUT_KEY,
TOKEN_KEY, VERSION_KEY, WARMUP_KEY, WEIGHT_KEY, TIMESTAMP_KEY,
DUBBO_VERSION_KEY, RELEASE_KEY};
+
+ String[] DEFAULT_REGISTER_CONSUMER_KEYS = {APPLICATION_KEY, VERSION_KEY,
GROUP_KEY, DUBBO_VERSION_KEY, RELEASE_KEY};
+
+ /**
+ * To decide whether register center saves file synchronously, the default
value is asynchronously
+ */
+ String REGISTRY_FILESAVE_SYNC_KEY = "save.file";
+
+ /**
+ * Period of registry center's retry interval
+ */
+ String REGISTRY_RETRY_PERIOD_KEY = "retry.period";
+
+ /**
+ * Most retry times
+ */
+ String REGISTRY_RETRY_TIMES_KEY = "retry.times";
+
+ /**
+ * Default value for the period of retry interval in milliseconds: 5000
+ */
+ int DEFAULT_REGISTRY_RETRY_PERIOD = 5 * 1000;
+
+ /**
+ * Default value for the times of retry: 3
+ */
+ int DEFAULT_REGISTRY_RETRY_TIMES = 3;
+
+ /**
+ * Reconnection period in milliseconds for register center
+ */
+ String REGISTRY_RECONNECT_PERIOD_KEY = "reconnect.period";
+
+ int DEFAULT_REGISTRY_RECONNECT_PERIOD = 3 * 1000;
+
+ String SESSION_TIMEOUT_KEY = "session";
+
+ int DEFAULT_SESSION_TIMEOUT = 60 * 1000;
+}