Skip to content

Commit 951ad36

Browse files
beiwei30chickenlj
authored andcommitted
Solve #3137, step 2, seperate constants for cluster, common, filter, monitor, and registry (#4020)
1 parent 30c3c2f commit 951ad36

File tree

6 files changed

+532
-0
lines changed

6 files changed

+532
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dubbo.common.constants;
19+
20+
public interface ClusterConstants {
21+
/**
22+
* key for router type, for e.g., "script"/"file", corresponding to ScriptRouterFactory.NAME, FileRouterFactory.NAME
23+
*/
24+
String ROUTER_KEY = "router";
25+
26+
String LOADBALANCE_KEY = "loadbalance";
27+
28+
String DEFAULT_LOADBALANCE = "random";
29+
30+
String FAIL_BACK_TASKS_KEY = "failbacktasks";
31+
32+
int DEFAULT_FAILBACK_TASKS = 100;
33+
34+
String RETRIES_KEY = "retries";
35+
36+
int DEFAULT_RETRIES = 2;
37+
38+
int DEFAULT_FAILBACK_TIMES = 3;
39+
40+
String FORKS_KEY = "forks";
41+
42+
int DEFAULT_FORKS = 2;
43+
44+
String WEIGHT_KEY = "weight";
45+
46+
int DEFAULT_WEIGHT = 100;
47+
48+
String MOCK_PROTOCOL = "mock";
49+
50+
String FORCE_KEY = "force";
51+
52+
/**
53+
* To decide whether to exclude unavailable invoker from the cluster
54+
*/
55+
String CLUSTER_AVAILABLE_CHECK_KEY = "cluster.availablecheck";
56+
57+
/**
58+
* The default value of cluster.availablecheck
59+
*
60+
* @see #CLUSTER_AVAILABLE_CHECK_KEY
61+
*/
62+
boolean DEFAULT_CLUSTER_AVAILABLE_CHECK = true;
63+
64+
/**
65+
* To decide whether to enable sticky strategy for cluster
66+
*/
67+
String CLUSTER_STICKY_KEY = "sticky";
68+
69+
/**
70+
* The default value of sticky
71+
*
72+
* @see #CLUSTER_STICKY_KEY
73+
*/
74+
boolean DEFAULT_CLUSTER_STICKY = false;
75+
76+
String ADDRESS_KEY = "address";
77+
78+
/**
79+
* When this attribute appears in invocation's attachment, mock invoker will be used
80+
*/
81+
String INVOCATION_NEED_MOCK = "invocation.need.mock";
82+
83+
/**
84+
* when ROUTER_KEY's value is set to ROUTER_TYPE_CLEAR, RegistryDirectory will clean all current routers
85+
*/
86+
String ROUTER_TYPE_CLEAR = "clean";
87+
88+
String DEFAULT_SCRIPT_TYPE_KEY = "javascript";
89+
90+
String PRIORITY_KEY = "priority";
91+
92+
String RULE_KEY = "rule";
93+
94+
String TYPE_KEY = "type";
95+
96+
String RUNTIME_KEY = "runtime";
97+
98+
String TAG_KEY = "dubbo.tag";
99+
100+
String REMOTE_TIMESTAMP_KEY = "remote.timestamp";
101+
102+
String WARMUP_KEY = "warmup";
103+
104+
int DEFAULT_WARMUP = 10 * 60 * 1000;
105+
106+
String CONFIG_VERSION_KEY = "configVersion";
107+
108+
String OVERRIDE_PROVIDERS_KEY = "providerAddresses";
109+
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dubbo.common.constants;
19+
20+
import java.util.regex.Pattern;
21+
22+
public interface CommonConstants {
23+
String DUBBO = "dubbo";
24+
25+
String PROVIDER = "provider";
26+
27+
String CONSUMER = "consumer";
28+
29+
String APPLICATION_KEY = "application";
30+
31+
String REMOTE_APPLICATION_KEY = "remote.application";
32+
33+
String ENABLED_KEY = "enabled";
34+
35+
String DISABLED_KEY = "disabled";
36+
37+
String DUBBO_PROPERTIES_KEY = "dubbo.properties.file";
38+
39+
String DEFAULT_DUBBO_PROPERTIES = "dubbo.properties";
40+
41+
String ANY_VALUE = "*";
42+
43+
String COMMA_SEPARATOR = ",";
44+
45+
Pattern COMMA_SPLIT_PATTERN = Pattern.compile("\\s*[,]+\\s*");
46+
47+
public final static String PATH_SEPARATOR = "/";
48+
49+
public final static String PROTOCOL_SEPARATOR = "://";
50+
51+
String REGISTRY_SEPARATOR = "|";
52+
53+
Pattern REGISTRY_SPLIT_PATTERN = Pattern.compile("\\s*[|;]+\\s*");
54+
55+
String SEMICOLON_SEPARATOR = ";";
56+
57+
Pattern SEMICOLON_SPLIT_PATTERN = Pattern.compile("\\s*[;]+\\s*");
58+
59+
String DEFAULT_PROXY = "javassist";
60+
61+
String DEFAULT_DIRECTORY = "dubbo";
62+
63+
String PROTOCOL_KEY = "protocol";
64+
65+
String DEFAULT_PROTOCOL = "dubbo";
66+
67+
String DEFAULT_THREAD_NAME = "Dubbo";
68+
69+
int DEFAULT_CORE_THREADS = 0;
70+
71+
int DEFAULT_THREADS = 200;
72+
73+
String THREADPOOL_KEY = "threadpool";
74+
75+
String THREAD_NAME_KEY = "threadname";
76+
77+
String CORE_THREADS_KEY = "corethreads";
78+
79+
String THREADS_KEY = "threads";
80+
81+
String QUEUES_KEY = "queues";
82+
83+
String ALIVE_KEY = "alive";
84+
85+
String DEFAULT_THREADPOOL = "limited";
86+
87+
String DEFAULT_CLIENT_THREADPOOL = "cached";
88+
89+
String IO_THREADS_KEY = "iothreads";
90+
91+
int DEFAULT_QUEUES = 0;
92+
93+
int DEFAULT_ALIVE = 60 * 1000;
94+
95+
String TIMEOUT_KEY = "timeout";
96+
97+
int DEFAULT_TIMEOUT = 1000;
98+
99+
String REMOVE_VALUE_PREFIX = "-";
100+
101+
String PROPERTIES_CHAR_SEPERATOR = "-";
102+
103+
String GROUP_CHAR_SEPERATOR = ":";
104+
105+
String HIDE_KEY_PREFIX = ".";
106+
107+
String DEFAULT_KEY_PREFIX = "default.";
108+
109+
String DEFAULT_KEY = "default";
110+
111+
/**
112+
* Default timeout value in milliseconds for server shutdown
113+
*/
114+
int DEFAULT_SERVER_SHUTDOWN_TIMEOUT = 10000;
115+
116+
String SIDE_KEY = "side";
117+
118+
String PROVIDER_SIDE = "provider";
119+
120+
String CONSUMER_SIDE = "consumer";
121+
122+
String ANYHOST_KEY = "anyhost";
123+
124+
String ANYHOST_VALUE = "0.0.0.0";
125+
126+
String LOCALHOST_KEY = "localhost";
127+
128+
String LOCALHOST_VALUE = "127.0.0.1";
129+
130+
String METHODS_KEY = "methods";
131+
132+
String METHOD_KEY = "method";
133+
134+
String PID_KEY = "pid";
135+
136+
String TIMESTAMP_KEY = "timestamp";
137+
138+
String GROUP_KEY = "group";
139+
140+
String PATH_KEY = "path";
141+
142+
String INTERFACE_KEY = "interface";
143+
144+
String FILE_KEY = "file";
145+
146+
String DUMP_DIRECTORY = "dump.directory";
147+
148+
String CLASSIFIER_KEY = "classifier";
149+
150+
String VERSION_KEY = "version";
151+
152+
String REVISION_KEY = "revision";
153+
154+
/**
155+
* package version in the manifest
156+
*/
157+
String RELEASE_KEY = "release";
158+
159+
int MAX_PROXY_COUNT = 65535;
160+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dubbo.common.constants;
19+
20+
public interface FilterConstants {
21+
String CACHE_KEY = "cache";
22+
23+
String VALIDATION_KEY = "validation";
24+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dubbo.common.constants;
19+
20+
public interface MetadataReportConstants {
21+
String METADATA_REPORT_KEY = "metadata";
22+
23+
String RETRY_TIMES_KEY = "retry.times";
24+
25+
Integer DEFAULT_METADATA_REPORT_RETRY_TIMES = 100;
26+
27+
String RETRY_PERIOD_KEY = "retry.period";
28+
29+
Integer DEFAULT_METADATA_REPORT_RETRY_PERIOD = 3000;
30+
31+
String SYNC_REPORT_KEY = "sync.report";
32+
33+
String CYCLE_REPORT_KEY = "cycle.report";
34+
35+
Boolean DEFAULT_METADATA_REPORT_CYCLE_REPORT = true;
36+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.dubbo.common.constants;
19+
20+
public interface MonitorConstants {
21+
String MONITOR_KEY = "monitor";
22+
23+
String LOGSTAT_PROTOCOL = "logstat";
24+
25+
String COUNT_PROTOCOL = "count";
26+
27+
String DUBBO_PROVIDER = "dubbo.provider";
28+
29+
String DUBBO_CONSUMER = "dubbo.consumer";
30+
31+
String DUBBO_PROVIDER_METHOD = "dubbo.provider.method";
32+
33+
String DUBBO_CONSUMER_METHOD = "dubbo.consumer.method";
34+
35+
String SERVICE = "service";
36+
37+
String METHOD = "method";
38+
39+
String DUBBO_GROUP = "dubbo";
40+
41+
String METRICS_KEY = "metrics";
42+
43+
String METRICS_PORT = "metrics.port";
44+
45+
String METRICS_PROTOCOL = "metrics.protocol";
46+
}

0 commit comments

Comments
 (0)