Skip to content

Commit 6a1dd65

Browse files
CrazyHZMbeiwei30
authored andcommitted
[DUBBO-3137]: step2 - seperate constants for config, remoting, rpc (#4021)
* constants step2 * change interface
1 parent 951ad36 commit 6a1dd65

File tree

3 files changed

+524
-0
lines changed

3 files changed

+524
-0
lines changed
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
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+
/**
21+
* ConfigConstants
22+
*/
23+
public interface ConfigConstants {
24+
// BEGIN dubbo-config-api
25+
String CLUSTER_KEY = "cluster";
26+
27+
String STATUS_KEY = "status";
28+
29+
String CONTEXTPATH_KEY = "contextpath";
30+
31+
String LISTENER_KEY = "listener";
32+
33+
String LAYER_KEY = "layer";
34+
35+
/**
36+
* General
37+
*/
38+
/**
39+
* Application name;
40+
*/
41+
String NAME = "name";
42+
43+
/**
44+
* Application owner name;
45+
*/
46+
String OWNER = "owner";
47+
48+
/**
49+
* Running application organization name.
50+
*/
51+
String ORGANIZATION = "organization";
52+
53+
/**
54+
* Application architecture name.
55+
*/
56+
String ARCHITECTURE = "architecture";
57+
58+
/**
59+
* Environment name
60+
*/
61+
String ENVIRONMENT = "environment";
62+
63+
/**
64+
* Test environment key.
65+
*/
66+
String TEST_ENVIRONMENT = "test";
67+
68+
/**
69+
* Development environment key.
70+
*/
71+
String DEVELOPMENT_ENVIRONMENT = "develop";
72+
73+
/**
74+
* Production environment key.
75+
*/
76+
String PRODUCTION_ENVIRONMENT = "product";
77+
78+
String CONFIG_CLUSTER_KEY = "config.cluster";
79+
String CONFIG_NAMESPACE_KEY = "config.namespace";
80+
String CONFIG_GROUP_KEY = "config.group";
81+
String CONFIG_CHECK_KEY = "config.check";
82+
83+
String CONFIG_CONFIGFILE_KEY = "config.config-file";
84+
String CONFIG_ENABLE_KEY = "config.highest-priority";
85+
String CONFIG_TIMEOUT_KEY = "config.timeout";
86+
String CONFIG_APPNAME_KEY = "config.app-name";
87+
88+
String USERNAME_KEY = "username";
89+
90+
String PASSWORD_KEY = "password";
91+
92+
String HOST_KEY = "host";
93+
94+
String PORT_KEY = "port";
95+
96+
String MULTICAST = "multicast";
97+
98+
String REGISTER_IP_KEY = "register.ip";
99+
100+
String DUBBO_IP_TO_REGISTRY = "DUBBO_IP_TO_REGISTRY";
101+
102+
String DUBBO_PORT_TO_REGISTRY = "DUBBO_PORT_TO_REGISTRY";
103+
104+
String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND";
105+
106+
String DUBBO_PORT_TO_BIND = "DUBBO_PORT_TO_BIND";
107+
108+
String SCOPE_KEY = "scope";
109+
110+
String SCOPE_LOCAL = "local";
111+
112+
String SCOPE_REMOTE = "remote";
113+
114+
String SCOPE_NONE = "none";
115+
116+
String ON_CONNECT_KEY = "onconnect";
117+
118+
String ON_DISCONNECT_KEY = "ondisconnect";
119+
120+
String ON_INVOKE_METHOD_KEY = "oninvoke.method";
121+
122+
String ON_RETURN_METHOD_KEY = "onreturn.method";
123+
124+
String ON_THROW_METHOD_KEY = "onthrow.method";
125+
126+
String ON_INVOKE_INSTANCE_KEY = "oninvoke.instance";
127+
128+
String ON_RETURN_INSTANCE_KEY = "onreturn.instance";
129+
130+
String ON_THROW_INSTANCE_KEY = "onthrow.instance";
131+
132+
@Deprecated
133+
String SHUTDOWN_WAIT_SECONDS_KEY = "dubbo.service.shutdown.wait.seconds";
134+
135+
String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait";
136+
137+
/**
138+
* The key name for export URL in register center
139+
*/
140+
String EXPORT_KEY = "export";
141+
142+
/**
143+
* The key name for reference URL in register center
144+
*/
145+
String REFER_KEY = "refer";
146+
147+
/**
148+
* To decide whether to make connection when the client is created
149+
*/
150+
String LAZY_CONNECT_KEY = "lazy";
151+
152+
String DUBBO_PROTOCOL = "dubbo";
153+
154+
String ZOOKEEPER_PROTOCOL = "zookeeper";
155+
156+
// FIXME: is this still useful?
157+
String SHUTDOWN_TIMEOUT_KEY = "shutdown.timeout";
158+
159+
int DEFAULT_SHUTDOWN_TIMEOUT = 1000 * 60 * 15;
160+
161+
String PROTOCOLS_SUFFIX = "dubbo.protocols.";
162+
163+
String PROTOCOL_SUFFIX = "dubbo.protocol.";
164+
165+
String REGISTRIES_SUFFIX = "dubbo.registries.";
166+
167+
String TELNET = "telnet";
168+
169+
String QOS_ENABLE = "qos.enable";
170+
171+
String QOS_PORT = "qos.port";
172+
173+
String ACCEPT_FOREIGN_IP = "qos.accept.foreign.ip";
174+
// END dubbo-congfig-api
175+
}
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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.concurrent.ExecutorService;
21+
22+
/**
23+
* RemotingConstants
24+
*/
25+
public interface RemotingConstants {
26+
27+
String PAYLOAD_KEY = "payload";
28+
/**
29+
* 8M
30+
*/
31+
int DEFAULT_PAYLOAD = 8 * 1024 * 1024;
32+
33+
String BUFFER_KEY = "buffer";
34+
35+
/**
36+
* default buffer size is 8k.
37+
*/
38+
int DEFAULT_BUFFER_SIZE = 8 * 1024;
39+
40+
int MAX_BUFFER_SIZE = 16 * 1024;
41+
42+
int MIN_BUFFER_SIZE = 1 * 1024;
43+
44+
String CONNECT_TIMEOUT_KEY = "connect.timeout";
45+
46+
int DEFAULT_CONNECT_TIMEOUT = 3000;
47+
48+
String HEARTBEAT_KEY = "heartbeat";
49+
50+
int DEFAULT_HEARTBEAT = 60 * 1000;
51+
52+
String IDLE_TIMEOUT_KEY = "idle.timeout";
53+
54+
int DEFAULT_IDLE_TIMEOUT = 600 * 1000;
55+
56+
String ACCEPTS_KEY = "accepts";
57+
58+
int DEFAULT_ACCEPTS = 0;
59+
60+
String SERIALIZATION_KEY = "serialization";
61+
62+
String DEFAULT_REMOTING_SERIALIZATION = "hessian2";
63+
64+
String CODEC_KEY = "codec";
65+
66+
String DEFAULT_REMOTING_CODEC = "dubbo";
67+
68+
String SERVER_KEY = "server";
69+
70+
String DEFAULT_REMOTING_SERVER = "netty";
71+
72+
String CLIENT_KEY = "client";
73+
74+
String DEFAULT_REMOTING_CLIENT = "netty";
75+
76+
String TRANSPORTER_KEY = "transporter";
77+
78+
String DEFAULT_TRANSPORTER = "netty";
79+
80+
String EXCHANGER_KEY = "exchanger";
81+
82+
String DEFAULT_EXCHANGER = "header";
83+
84+
String DISPACTHER_KEY = "dispacther";
85+
86+
int DEFAULT_IO_THREADS = Math.min(Runtime.getRuntime().availableProcessors() + 1, 32);
87+
88+
String BIND_IP_KEY = "bind.ip";
89+
90+
String BIND_PORT_KEY = "bind.port";
91+
92+
String SENT_KEY = "sent";
93+
94+
boolean DEFAULT_SENT = false;
95+
96+
String DISPATCHER_KEY = "dispatcher";
97+
98+
String CHANNEL_HANDLER_KEY = "channel.handler";
99+
100+
String DEFAULT_CHANNEL_HANDLER = "default";
101+
102+
String SERVICE_DESCIPTOR_KEY = "serviceDescriptor";
103+
104+
String CONNECT_QUEUE_CAPACITY = "connect.queue.capacity";
105+
106+
String CONNECT_QUEUE_WARNING_SIZE = "connect.queue.warning.size";
107+
108+
int DEFAULT_CONNECT_QUEUE_WARNING_SIZE = 1000;
109+
110+
String CHANNEL_ATTRIBUTE_READONLY_KEY = "channel.readonly";
111+
112+
String CHANNEL_READONLYEVENT_SENT_KEY = "channel.readonly.sent";
113+
114+
String CHANNEL_SEND_READONLYEVENT_KEY = "channel.readonly.send";
115+
116+
String EXECUTOR_SERVICE_COMPONENT_KEY = ExecutorService.class.getName();
117+
118+
String CHARSET_KEY = "charset";
119+
120+
String DEFAULT_CHARSET = "UTF-8";
121+
122+
String BACKUP_KEY = "backup";
123+
124+
/**
125+
* Every heartbeat duration / HEATBEAT_CHECK_TICK, check if a heartbeat should be sent. Every heartbeat timeout
126+
* duration / HEATBEAT_CHECK_TICK, check if a connection should be closed on server side, and if reconnect on
127+
* client side
128+
*/
129+
int HEARTBEAT_CHECK_TICK = 3;
130+
131+
/**
132+
* the least heartbeat during is 1000 ms.
133+
*/
134+
long LEAST_HEARTBEAT_DURATION = 1000;
135+
136+
/**
137+
* ticks per wheel.
138+
*/
139+
int TICKS_PER_WHEEL = 128;
140+
141+
String HEARTBEAT_TIMEOUT_KEY = "heartbeat.timeout";
142+
143+
String RECONNECT_KEY = "reconnect";
144+
145+
int DEFAULT_RECONNECT_PERIOD = 2000;
146+
147+
String SEND_RECONNECT_KEY = "send.reconnect";
148+
149+
String CHECK_KEY = "check";
150+
151+
String PROMPT_KEY = "prompt";
152+
153+
String DEFAULT_PROMPT = "dubbo>";
154+
}

0 commit comments

Comments
 (0)