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 new file mode 100644 index 00000000000..5899641a625 --- /dev/null +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/ConfigConstants.java @@ -0,0 +1,175 @@ +/* + * 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; + +/** + * ConfigConstants + */ +public interface ConfigConstants { + // BEGIN dubbo-config-api + 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"; + + String HOST_KEY = "host"; + + 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"; + + String SHUTDOWN_WAIT_KEY = "dubbo.service.shutdown.wait"; + + /** + * The key name for export URL in register center + */ + String EXPORT_KEY = "export"; + + /** + * The key name for reference URL in register center + */ + String REFER_KEY = "refer"; + + /** + * To decide whether to make connection when the client is created + */ + String LAZY_CONNECT_KEY = "lazy"; + + String DUBBO_PROTOCOL = "dubbo"; + + 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"; + + String QOS_PORT = "qos.port"; + + String ACCEPT_FOREIGN_IP = "qos.accept.foreign.ip"; + // END dubbo-congfig-api +} diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RemotingConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RemotingConstants.java new file mode 100644 index 00000000000..4e50feea1c9 --- /dev/null +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RemotingConstants.java @@ -0,0 +1,154 @@ +/* + * 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.concurrent.ExecutorService; + +/** + * RemotingConstants + */ +public interface RemotingConstants { + + String PAYLOAD_KEY = "payload"; + /** + * 8M + */ + int DEFAULT_PAYLOAD = 8 * 1024 * 1024; + + String BUFFER_KEY = "buffer"; + + /** + * default buffer size is 8k. + */ + int DEFAULT_BUFFER_SIZE = 8 * 1024; + + int MAX_BUFFER_SIZE = 16 * 1024; + + int MIN_BUFFER_SIZE = 1 * 1024; + + String CONNECT_TIMEOUT_KEY = "connect.timeout"; + + int DEFAULT_CONNECT_TIMEOUT = 3000; + + String HEARTBEAT_KEY = "heartbeat"; + + int DEFAULT_HEARTBEAT = 60 * 1000; + + String IDLE_TIMEOUT_KEY = "idle.timeout"; + + int DEFAULT_IDLE_TIMEOUT = 600 * 1000; + + String ACCEPTS_KEY = "accepts"; + + int DEFAULT_ACCEPTS = 0; + + String SERIALIZATION_KEY = "serialization"; + + String DEFAULT_REMOTING_SERIALIZATION = "hessian2"; + + String CODEC_KEY = "codec"; + + String DEFAULT_REMOTING_CODEC = "dubbo"; + + String SERVER_KEY = "server"; + + String DEFAULT_REMOTING_SERVER = "netty"; + + String CLIENT_KEY = "client"; + + String DEFAULT_REMOTING_CLIENT = "netty"; + + String TRANSPORTER_KEY = "transporter"; + + String DEFAULT_TRANSPORTER = "netty"; + + String EXCHANGER_KEY = "exchanger"; + + String DEFAULT_EXCHANGER = "header"; + + String DISPACTHER_KEY = "dispacther"; + + int DEFAULT_IO_THREADS = Math.min(Runtime.getRuntime().availableProcessors() + 1, 32); + + String BIND_IP_KEY = "bind.ip"; + + String BIND_PORT_KEY = "bind.port"; + + String SENT_KEY = "sent"; + + boolean DEFAULT_SENT = false; + + String DISPATCHER_KEY = "dispatcher"; + + String CHANNEL_HANDLER_KEY = "channel.handler"; + + String DEFAULT_CHANNEL_HANDLER = "default"; + + String SERVICE_DESCIPTOR_KEY = "serviceDescriptor"; + + String CONNECT_QUEUE_CAPACITY = "connect.queue.capacity"; + + String CONNECT_QUEUE_WARNING_SIZE = "connect.queue.warning.size"; + + int DEFAULT_CONNECT_QUEUE_WARNING_SIZE = 1000; + + String CHANNEL_ATTRIBUTE_READONLY_KEY = "channel.readonly"; + + String CHANNEL_READONLYEVENT_SENT_KEY = "channel.readonly.sent"; + + String CHANNEL_SEND_READONLYEVENT_KEY = "channel.readonly.send"; + + String EXECUTOR_SERVICE_COMPONENT_KEY = ExecutorService.class.getName(); + + String CHARSET_KEY = "charset"; + + String DEFAULT_CHARSET = "UTF-8"; + + String BACKUP_KEY = "backup"; + + /** + * Every heartbeat duration / HEATBEAT_CHECK_TICK, check if a heartbeat should be sent. Every heartbeat timeout + * duration / HEATBEAT_CHECK_TICK, check if a connection should be closed on server side, and if reconnect on + * client side + */ + int HEARTBEAT_CHECK_TICK = 3; + + /** + * the least heartbeat during is 1000 ms. + */ + long LEAST_HEARTBEAT_DURATION = 1000; + + /** + * ticks per wheel. + */ + int TICKS_PER_WHEEL = 128; + + String HEARTBEAT_TIMEOUT_KEY = "heartbeat.timeout"; + + String RECONNECT_KEY = "reconnect"; + + int DEFAULT_RECONNECT_PERIOD = 2000; + + String SEND_RECONNECT_KEY = "send.reconnect"; + + String CHECK_KEY = "check"; + + String PROMPT_KEY = "prompt"; + + String DEFAULT_PROMPT = "dubbo>"; +} diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RpcConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RpcConstants.java new file mode 100644 index 00000000000..9e7302ff0ad --- /dev/null +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/RpcConstants.java @@ -0,0 +1,195 @@ +/* + * 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; + +/** + * RpcConstants + */ +public interface RpcConstants { + // BEGIN dubbo-rpc-hessian + String HESSIAN2_REQUEST_KEY = "hessian2.request"; + + boolean DEFAULT_HESSIAN2_REQUEST = false; + + String HESSIAN_OVERLOAD_METHOD_KEY = "hessian.overload.method"; + + boolean DEFAULT_HESSIAN_OVERLOAD_METHOD = false; + + String DEFAULT_HTTP_CLIENT = "jdk"; + + String DEFAULT_HTTP_SERVER = "servlet"; + + String DEFAULT_HTTP_SERIALIZATION = "json"; + // END dubbo-rpc-hessian + + // BEGIN dubbo-rpc-dubbo + String SHARE_CONNECTIONS_KEY = "shareconnections"; + + /** + * By default, a consumer JVM instance and a provider JVM instance share a long TCP connection (except when connections are set), + * which can set the number of long TCP connections shared to avoid the bottleneck of sharing a single long TCP connection. + */ + String DEFAULT_SHARE_CONNECTIONS = "1"; + + String INPUT_KEY = "input"; + + String OUTPUT_KEY = "output"; + + String DECODE_IN_IO_THREAD_KEY = "decode.in.io"; + + boolean DEFAULT_DECODE_IN_IO_THREAD = true; + + /** + * callback inst id + */ + String CALLBACK_SERVICE_KEY = "callback.service.instid"; + + /** + * The limit of callback service instances for one interface on every client + */ + String CALLBACK_INSTANCES_LIMIT_KEY = "callbacks"; + + /** + * The default limit number for callback service instances + * + * @see #CALLBACK_INSTANCES_LIMIT_KEY + */ + int DEFAULT_CALLBACK_INSTANCES = 1; + + String CALLBACK_SERVICE_PROXY_KEY = "callback.service.proxy"; + + String IS_CALLBACK_SERVICE = "is_callback_service"; + + /** + * Invokers in channel's callback + */ + String CHANNEL_CALLBACK_KEY = "channel.callback.invokers.key"; + + /** + * The initial state for lazy connection + */ + String LAZY_CONNECT_INITIAL_STATE_KEY = "connect.lazy.initial.state"; + + /** + * The default value of lazy connection's initial state: true + * + * @see #LAZY_CONNECT_INITIAL_STATE_KEY + */ + boolean DEFAULT_LAZY_CONNECT_INITIAL_STATE = true; + + String OPTIMIZER_KEY = "optimizer"; + // END dubbo-rpc-dubbo + + + // BEGIN dubbo-rpc-api + String DUBBO_VERSION_KEY = "dubbo"; + + String LOCAL_KEY = "local"; + + String STUB_KEY = "stub"; + + String MOCK_KEY = "mock"; + + String DEPRECATED_KEY = "deprecated"; + + String $INVOKE = "$invoke"; + + String $ECHO = "$echo"; + + String RETURN_PREFIX = "return "; + + String THROW_PREFIX = "throw"; + + String FAIL_PREFIX = "fail:"; + + String FORCE_PREFIX = "force:"; + + String MERGER_KEY = "merger"; + + String IS_SERVER_KEY = "isserver"; + + String FORCE_USE_TAG = "dubbo.force.tag"; + + String GENERIC_SERIALIZATION_NATIVE_JAVA = "nativejava"; + + String GENERIC_SERIALIZATION_DEFAULT = "true"; + + String GENERIC_SERIALIZATION_BEAN = "bean"; + + String GENERIC_SERIALIZATION_PROTOBUF = "protobuf-json"; + + String TPS_LIMIT_RATE_KEY = "tps"; + + String TPS_LIMIT_INTERVAL_KEY = "tps.interval"; + + long DEFAULT_TPS_LIMIT_INTERVAL = 60 * 1000; + + String AUTO_ATTACH_INVOCATIONID_KEY = "invocationid.autoattach"; + + String STUB_EVENT_KEY = "dubbo.stub.event"; + + boolean DEFAULT_STUB_EVENT = false; + + String STUB_EVENT_METHODS_KEY = "dubbo.stub.event.methods"; + + String PROXY_KEY = "proxy"; + + String EXECUTES_KEY = "executes"; + + String REFERENCE_FILTER_KEY = "reference.filter"; + + String INVOKER_LISTENER_KEY = "invoker.listener"; + + String SERVICE_FILTER_KEY = "service.filter"; + + String EXPORTER_LISTENER_KEY = "exporter.listener"; + + String ACCESS_LOG_KEY = "accesslog"; + + String ACTIVES_KEY = "actives"; + + String CONNECTIONS_KEY = "connections"; + + String ID_KEY = "id"; + + String ASYNC_KEY = "async"; + + String FUTURE_GENERATED_KEY = "future_generated"; + + String FUTURE_RETURNTYPE_KEY = "future_returntype"; + + String RETURN_KEY = "return"; + + String TOKEN_KEY = "token"; + + String INTERFACES = "interfaces"; + + String GENERIC_KEY = "generic"; + + String LOCAL_PROTOCOL = "injvm"; + // END dubbo-rpc-api + + + // BEGIN dubbo-rpc-rest + String KEEP_ALIVE_KEY = "keepalive"; + + boolean DEFAULT_KEEP_ALIVE = true; + + String EXTENSION_KEY = "extension"; + // END dubbo-rpc-rest +}