Skip to content

Commit

Permalink
constants step4 rpc (apache#4072)
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyHZM authored and beiwei30 committed May 16, 2019
1 parent 85e595e commit 1798fed
Show file tree
Hide file tree
Showing 85 changed files with 401 additions and 313 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import java.util.stream.Collectors;

import static org.apache.dubbo.rpc.cluster.Constants.TAG_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.FORCE_USE_TAG;
import static org.apache.dubbo.rpc.Constants.FORCE_USE_TAG;

/**
* TagRouter, "application.tag-router"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.DUBBO_VERSION_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.rpc.Constants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.REFERENCE_FILTER_KEY;

/**
* ClusterUtils
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.MERGER_KEY;
import static org.apache.dubbo.rpc.Constants.MERGER_KEY;

@SuppressWarnings("unchecked")
public class MergeableClusterInvoker<T> extends AbstractClusterInvoker<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import java.util.List;

import static org.apache.dubbo.rpc.cluster.Constants.INVOCATION_NEED_MOCK;
import static org.apache.dubbo.common.constants.RpcConstants.MOCK_KEY;
import static org.apache.dubbo.rpc.Constants.MOCK_KEY;

public class MockClusterInvoker<T> implements Invoker<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.DUBBO_VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.TOKEN_KEY;
import static org.apache.dubbo.rpc.Constants.TOKEN_KEY;

/**
* MockInvocation.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.Map;

import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.MERGER_KEY;
import static org.apache.dubbo.rpc.Constants.MERGER_KEY;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.Arrays;
import java.util.List;

import static org.apache.dubbo.common.constants.RpcConstants.MOCK_KEY;
import static org.apache.dubbo.rpc.Constants.MOCK_KEY;

public class MockClusterInvokerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,44 +21,11 @@
* 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
*/
Expand All @@ -71,125 +38,10 @@ public interface RpcConstants {
*/
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
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.TOKEN_KEY;
import static org.apache.dubbo.rpc.Constants.TOKEN_KEY;

/**
* MockInvocation.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.TIMEOUT_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.DUBBO_VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.TOKEN_KEY;
import static org.apache.dubbo.rpc.Constants.TOKEN_KEY;

/**
* MockInvocation.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.SUBSCRIBE_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.DUBBO_VERSION_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.LOCAL_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.PROXY_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.REFERENCE_FILTER_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.RETURN_PREFIX;
import static org.apache.dubbo.common.constants.RpcConstants.THROW_PREFIX;
import static org.apache.dubbo.rpc.Constants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.LOCAL_KEY;
import static org.apache.dubbo.rpc.Constants.PROXY_KEY;
import static org.apache.dubbo.rpc.Constants.REFERENCE_FILTER_KEY;
import static org.apache.dubbo.rpc.Constants.RETURN_PREFIX;
import static org.apache.dubbo.rpc.Constants.THROW_PREFIX;
import static org.apache.dubbo.common.extension.ExtensionLoader.getExtensionLoader;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import java.util.Map;

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;
import static org.apache.dubbo.common.constants.RpcConstants.RETURN_PREFIX;
import static org.apache.dubbo.common.constants.RpcConstants.THROW_PREFIX;
import static org.apache.dubbo.rpc.Constants.FAIL_PREFIX;
import static org.apache.dubbo.rpc.Constants.FORCE_PREFIX;
import static org.apache.dubbo.rpc.Constants.MOCK_KEY;
import static org.apache.dubbo.rpc.Constants.RETURN_PREFIX;
import static org.apache.dubbo.rpc.Constants.THROW_PREFIX;

/**
* AbstractMethodConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
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;
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;
import static org.apache.dubbo.rpc.Constants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.REFERENCE_FILTER_KEY;
import static org.apache.dubbo.rpc.Constants.STUB_EVENT_KEY;

/**
* AbstractConsumerConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

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.RpcConstants.SERVICE_FILTER_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.EXPORTER_LISTENER_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.TOKEN_KEY;
import static org.apache.dubbo.rpc.Constants.SERVICE_FILTER_KEY;
import static org.apache.dubbo.rpc.Constants.EXPORTER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.TOKEN_KEY;

/**
* AbstractServiceConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.CONSUMER_PROTOCOL;
import static org.apache.dubbo.common.constants.RegistryConstants.REGISTRY_PROTOCOL;
import static org.apache.dubbo.common.constants.RpcConstants.LOCAL_PROTOCOL;
import static org.apache.dubbo.rpc.Constants.LOCAL_PROTOCOL;
import static org.apache.dubbo.common.utils.NetUtils.isInvalidLocalHost;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
import static org.apache.dubbo.common.constants.ConfigConstants.SCOPE_REMOTE;
import static org.apache.dubbo.common.constants.CommonConstants.MONITOR_KEY;
import static org.apache.dubbo.common.constants.RegistryConstants.DYNAMIC_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.GENERIC_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.LOCAL_PROTOCOL;
import static org.apache.dubbo.common.constants.RpcConstants.PROXY_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.TOKEN_KEY;
import static org.apache.dubbo.rpc.Constants.GENERIC_KEY;
import static org.apache.dubbo.rpc.Constants.LOCAL_PROTOCOL;
import static org.apache.dubbo.rpc.Constants.PROXY_KEY;
import static org.apache.dubbo.rpc.Constants.TOKEN_KEY;
import static org.apache.dubbo.common.utils.NetUtils.getAvailablePort;
import static org.apache.dubbo.common.utils.NetUtils.getLocalHost;
import static org.apache.dubbo.common.utils.NetUtils.isInvalidLocalHost;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
/**
* Export an stub service for event dispatch, default value is false.
*
* @see RpcConstants#STUB_EVENT_METHODS_KEY
* @see org.apache.dubbo.rpc.Constants#STUB_EVENT_METHODS_KEY
*/
boolean stubevent() default false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import java.util.Map;

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;
import static org.apache.dubbo.rpc.Constants.INVOKER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.REFERENCE_FILTER_KEY;
import static org.apache.dubbo.rpc.Constants.STUB_EVENT_KEY;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

import static org.apache.dubbo.common.constants.RpcConstants.SERVICE_FILTER_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.EXPORTER_LISTENER_KEY;
import static org.apache.dubbo.rpc.Constants.SERVICE_FILTER_KEY;
import static org.apache.dubbo.rpc.Constants.EXPORTER_LISTENER_KEY;

public class AbstractServiceConfigTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.apache.dubbo.common.constants.RpcConstants.LOCAL_PROTOCOL;
import static org.apache.dubbo.rpc.Constants.LOCAL_PROTOCOL;

public class ReferenceConfigTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@
import static org.apache.dubbo.common.constants.ConfigConstants.SHUTDOWN_WAIT_KEY;
import static org.apache.dubbo.common.constants.RemotingConstants.BIND_IP_KEY;
import static org.apache.dubbo.common.constants.RemotingConstants.BIND_PORT_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.GENERIC_KEY;
import static org.apache.dubbo.common.constants.RpcConstants.GENERIC_SERIALIZATION_BEAN;
import static org.apache.dubbo.common.constants.RpcConstants.GENERIC_SERIALIZATION_DEFAULT;
import static org.apache.dubbo.common.constants.RpcConstants.GENERIC_SERIALIZATION_NATIVE_JAVA;
import static org.apache.dubbo.rpc.Constants.GENERIC_KEY;
import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_BEAN;
import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_DEFAULT;
import static org.apache.dubbo.rpc.Constants.GENERIC_SERIALIZATION_NATIVE_JAVA;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
Expand Down
Loading

0 comments on commit 1798fed

Please sign in to comment.