diff --git a/dubbo-config/dubbo-config-api/pom.xml b/dubbo-config/dubbo-config-api/pom.xml index d52a9097f4d..7a1e880527e 100644 --- a/dubbo-config/dubbo-config-api/pom.xml +++ b/dubbo-config/dubbo-config-api/pom.xml @@ -1,17 +1,18 @@ diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java index 015af60c1f2..0c4d9f0debd 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -35,9 +36,8 @@ import java.util.regex.Pattern; /** - * 配置解析的工具方法、公共方法 + * Utility methods and public methods for parsing configuration * - * @author william.liangf * @export */ public abstract class AbstractConfig implements Serializable { @@ -485,7 +485,7 @@ && isPrimitive(method.getReturnType())) { } buf.append(" />"); return buf.toString(); - } catch (Throwable t) { // 防御性容错 + } catch (Throwable t) { logger.warn(t.getMessage(), t); return super.toString(); } diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java index f2335dce643..28446d114f9 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -43,62 +44,66 @@ /** * AbstractDefaultConfig * - * @author william.liangf * @export */ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig { private static final long serialVersionUID = -1559314110797223229L; - // 服务接口的本地实现类名 + // local impl class name for the service interface protected String local; - // 服务接口的本地实现类名 + // local stub class name for the service interface protected String stub; - // 服务监控 + // service monitor protected MonitorConfig monitor; - // 代理类型 + // proxy type protected String proxy; - // 集群方式 + // cluster type protected String cluster; - // 过滤器 + // filter protected String filter; - // 监听器 + // listener protected String listener; - // 负责人 + // owner protected String owner; - // 连接数限制,0表示共享连接,否则为该服务独享连接数 + // connection limits, 0 means shared connection, otherwise it defines the connections delegated to the + // current service protected Integer connections; - // 连接数限制 + // layer protected String layer; - // 应用信息 + // application info protected ApplicationConfig application; - // 模块信息 + // module info protected ModuleConfig module; - // 注册中心 + // registry centers protected List registries; - // 连接事件 + + // connection events protected String onconnect; - // 断开事件 + + // disconnection events protected String ondisconnect; - // callback实例个数限制 + + // callback limits private Integer callbacks; - // 服务暴露或引用的scope,如果为local,则表示只在当前JVM内查找. + + // the scope for referring/exporting a service, if it's local, it means searching in current JVM only. private String scope; protected void checkRegistry() { - // 兼容旧版本 + // for backward compatibility if (registries == null || registries.size() == 0) { String address = ConfigUtils.getProperty("dubbo.registry.address"); if (address != null && address.length() > 0) { @@ -127,7 +132,7 @@ protected void checkRegistry() { @SuppressWarnings("deprecation") protected void checkApplication() { - // 兼容旧版本 + // for backward compatibility if (application == null) { String applicationName = ConfigUtils.getProperty("dubbo.application.name"); if (applicationName != null && applicationName.length() > 0) { @@ -243,11 +248,11 @@ protected URL loadMonitor(URL registryURL) { } protected void checkInterfaceAndMethods(Class interfaceClass, List methods) { - // 接口不能为空 + // interface cannot be null if (interfaceClass == null) { throw new IllegalStateException("interface not allow null!"); } - // 检查接口类型必需为接口 + // to verify interfaceClass is an interface if (!interfaceClass.isInterface()) { throw new IllegalStateException("The interface class " + interfaceClass + " is not a interface!"); } diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java index d2975e1dbfc..266c5db8676 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractMethodConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -24,44 +25,43 @@ /** * AbstractMethodConfig * - * @author william.liangf * @export */ public abstract class AbstractMethodConfig extends AbstractConfig { private static final long serialVersionUID = 1L; - // 远程调用超时时间(毫秒) + // timeout for remote invocation in milliseconds protected Integer timeout; - // 重试次数 + // retry times protected Integer retries; - // 最大并发调用 + // max concurrent invocations protected Integer actives; - // 负载均衡 + // load balance protected String loadbalance; - // 是否异步 + // whether to async protected Boolean async; - // 异步发送是否等待发送成功 + // whether to ack async-sent protected Boolean sent; - // 服务接口的失败mock实现类名 + // the name of mock class which gets called when a service fails to execute protected String mock; - // 合并器 + // merger protected String merger; - // 服务接口的失败mock实现类名 + // cache protected String cache; - // 服务接口的失败mock实现类名 + // validation protected String validation; - // 自定义参数 + // customized parameters protected Map parameters; public Integer getTimeout() { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractReferenceConfig.java index c90dc7be23f..c3f02642a15 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractReferenceConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -20,11 +21,9 @@ import com.alibaba.dubbo.rpc.InvokerListener; import com.alibaba.dubbo.rpc.support.ProtocolUtils; - /** * AbstractConsumerConfig * - * @author william.liangf * @export * @see com.alibaba.dubbo.config.ReferenceConfig */ @@ -32,18 +31,18 @@ public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig { private static final long serialVersionUID = -2786526984373031126L; - // ======== 引用缺省值,当引用属性未设置时使用该缺省值替代 ======== + // ======== Reference config default values, will take effect if reference's attribute is not set ======== - // 检查服务提供者是否存在 + // check if service provider exists protected Boolean check; - // 是否加载时即刻初始化 + // whether to eagle-init protected Boolean init; - // 是否使用泛接口 + // whether to use generic interface protected String generic; - // 优先从JVM内获取引用实例 + // whether to find reference's instance from the current JVM protected Boolean injvm; // lazy create connection @@ -53,13 +52,13 @@ public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig { protected Boolean sticky; - //stub是否支持event事件. //TODO slove merge problem + // whether to support event in stub. //TODO solve merge problem protected Boolean stubevent;//= Constants.DEFAULT_STUB_EVENT; - // 版本 + // version protected String version; - // 服务分组 + // group protected String group; public Boolean isCheck() { @@ -99,7 +98,7 @@ public void setGeneric(String generic) { /** * @return - * @deprecated 通过scope进行判断,scope=local + * @deprecated instead, use scope to judge if it's in jvm, scope=local */ @Deprecated public Boolean isInjvm() { @@ -108,7 +107,7 @@ public Boolean isInjvm() { /** * @param injvm - * @deprecated 通过scope设置,scope=local表示使用injvm协议. + * @deprecated instead, use scope to judge if it's in jvm, scope=local */ @Deprecated public void setInjvm(Boolean injvm) { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java index 1e954b6029b..b4da2b701c4 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractServiceConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -25,49 +26,48 @@ /** * AbstractServiceConfig * - * @author william.liangf * @export */ public abstract class AbstractServiceConfig extends AbstractInterfaceConfig { private static final long serialVersionUID = 1L; - // 服务版本 + // version protected String version; - // 服务分组 + // group protected String group; - // 服务是否已经deprecated + // whether the service is deprecated protected Boolean deprecated; - // 延迟暴露 + // delay service exporting protected Integer delay; - // 是否暴露 + // whether to export the service protected Boolean export; - // 权重 + // weight protected Integer weight; - // 应用文档 + // document center protected String document; - // 在注册中心上注册成动态的还是静态的服务 + // whether to register as a dynamic service or not on register center protected Boolean dynamic; - // 是否使用令牌 + // whether to use token protected String token; - // 访问日志 + // access log protected String accesslog; protected List protocols; - // 允许执行请求数 + // max allowed execute times private Integer executes; - // 是否注册 + // whether to register private Boolean register; - // 预热时间 + // warm up period private Integer warmup; public String getVersion() { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java index 6fa319bd2d7..782abe6981d 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ApplicationConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -28,50 +29,49 @@ /** * ApplicationConfig * - * @author william.liangf * @export */ public class ApplicationConfig extends AbstractConfig { private static final long serialVersionUID = 5508512956753757169L; - // 应用名称 + // application name private String name; - // 模块版本 + // module version private String version; - // 应用负责人 + // application owner private String owner; - // 组织名(BU或部门) + // application's organization (BU) private String organization; - // 分层 + // architecture layer private String architecture; - // 环境,如:dev/test/run + // environment, e.g. dev, test or production private String environment; - // Java代码编译器 + // Java compiler private String compiler; - // 日志输出方式 + // logger private String logger; - // 注册中心 + // registry centers private List registries; - // 服务监控 + // monitor center private MonitorConfig monitor; - // 是否为缺省 + // is default or not private Boolean isDefault; - // thread stack存储路径 + // directory for saving thread dump private String dumpDirectory; - // 自定义参数 + // customized parameters private Map parameters; public ApplicationConfig() { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java index 6ed7b91c157..61fff8defce 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ArgumentConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -20,7 +21,6 @@ import java.io.Serializable; /** - * @author chao.liuc * @export */ public class ArgumentConfig implements Serializable { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java index a3fbdae68a1..fcf96deaa52 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ConsumerConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -18,17 +19,16 @@ /** * ConsumerConfig * - * @author william.liangf * @export */ public class ConsumerConfig extends AbstractReferenceConfig { private static final long serialVersionUID = 2827274711143680600L; - // 是否为缺省 + // is default or not private Boolean isDefault; - // 网络通信框架的客户端类型: netty mina ... + // networking framework client uses: netty, mina, etc. private String client; @Override diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java index 71b2875c482..28230fd9e49 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MethodConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -23,53 +24,52 @@ /** * MethodConfig * - * @author william.liangf * @export */ public class MethodConfig extends AbstractMethodConfig { private static final long serialVersionUID = 884908855422675941L; - // 方法名 + // method name private String name; - // 统计参数 + // stat private Integer stat; - // 是否重试 + // whether to retry private Boolean retry; - // 是否为可靠异步 + // if it's reliable private Boolean reliable; - // 方法使用线程数限制 + // thread limits for method invocations private Integer executes; - // 是否过时 + // if it's deprecated private Boolean deprecated; - // 是否需要开启stiky策略 + // whether to enable sticky private Boolean sticky; - // 是否需要返回 + // whether need to return private Boolean isReturn; - //异步调用回调实例 + // callback instance when async-call is invoked private Object oninvoke; - //异步调用回调方法 + // callback method when async-call is invoked private String oninvokeMethod; - //异步调用回调实例 + // callback instance when async-call is returned private Object onreturn; - //异步调用回调方法 + // callback method when async-call is returned private String onreturnMethod; - //异步调用异常回调实例 + // callback instance when async-call has exception thrown private Object onthrow; - //异步调用异常回调方法 + // callback method when async-call has exception thrown private String onthrowMethod; private List arguments; diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java index 4ec1286f681..720ee5853d0 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ModuleConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -23,32 +24,31 @@ /** * ModuleConfig * - * @author william.liangf * @export */ public class ModuleConfig extends AbstractConfig { private static final long serialVersionUID = 5508512956753757169L; - // 模块名称 + // module name private String name; - // 模块版本 + // module version private String version; - // 应用负责人 + // module owner private String owner; - // 组织名(BU或部门) + // module's organization private String organization; - // 注册中心 + // registry centers private List registries; - // 服务监控 + // monitor center private MonitorConfig monitor; - // 是否为缺省 + // if it's default private Boolean isDefault; public ModuleConfig() { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java index 2ec38459cd4..9d51517ca59 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/MonitorConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -22,7 +23,6 @@ /** * MonitorConfig * - * @author william.liangf * @export */ public class MonitorConfig extends AbstractConfig { @@ -41,10 +41,10 @@ public class MonitorConfig extends AbstractConfig { private String version; - // 自定义参数 + // customized parameters private Map parameters; - // 是否为缺省 + // if it's default private Boolean isDefault; public MonitorConfig() { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java index 5e85143bde0..96691124895 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -34,95 +35,94 @@ /** * ProtocolConfig * - * @author william.liangf * @export */ public class ProtocolConfig extends AbstractConfig { private static final long serialVersionUID = 6913423882496634749L; - // 服务协议 + // protocol name private String name; - // 服务IP地址(多网卡时使用) + // service IP address (when there are multiple network cards available) private String host; - // 服务端口 + // service port private Integer port; - // 上下文路径 + // context path private String contextpath; - // 线程池类型 + // thread pool private String threadpool; - // 线程池大小(固定大小) + // thread pool size (fixed size) private Integer threads; - // IO线程池大小(固定大小) + // IO thread pool size (fixed size) private Integer iothreads; - // 线程池队列大小 + // thread pool's queue length private Integer queues; - // 最大接收连接数 + // max acceptable connections private Integer accepts; - // 协议编码 + // protocol codec private String codec; - // 序列化方式 + // serialization private String serialization; - // 字符集 + // charset private String charset; - // 最大请求数据长度 + // payload max length private Integer payload; - // 缓存区大小 + // buffer size private Integer buffer; - // 心跳间隔 + // heartbeat interval private Integer heartbeat; - // 访问日志 + // access log private String accesslog; - // 网络传输方式 + // transfort private String transporter; - // 信息交换方式 + // how information is exchanged private String exchanger; - // 信息线程模型派发方式 + // thread dispatch mode private String dispatcher; - // 对称网络组网方式 + // networker private String networker; - // 服务器端实现 + // sever impl private String server; - // 客户端实现 + // client impl private String client; - // 支持的telnet命令,多个命令用逗号分隔 + // supported telnet commands, separated with comma. private String telnet; - // 命令行提示符 + // command line prompt private String prompt; - // status检查 + // status check private String status; - // 是否注册 + // whether to register private Boolean register; - // 参数 + // parameters private Map parameters; - // 是否为缺省 + // if it's default private Boolean isDefault; private static final AtomicBoolean destroyed = new AtomicBoolean(false); @@ -390,7 +390,7 @@ public void setExchanger(String exchanger) { } /** - * 单词拼写错误,请使用{@link #getDispatcher()} + * typo, switch to use {@link #getDispatcher()} * * @deprecated {@link #getDispatcher()} */ @@ -401,7 +401,7 @@ public String getDispather() { } /** - * 单词拼写错误,请使用{@link #setDispatcher(String) + * typo, switch to use {@link #getDispatcher()} * * @deprecated {@link #setDispatcher(String)} */ diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProviderConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProviderConfig.java index adbb9648498..62be91fe533 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProviderConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProviderConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -29,7 +30,6 @@ /** * ProviderConfig * - * @author william.liangf * @export * @see com.alibaba.dubbo.config.ProtocolConfig * @see com.alibaba.dubbo.config.ServiceConfig @@ -38,78 +38,78 @@ public class ProviderConfig extends AbstractServiceConfig { private static final long serialVersionUID = 6913423882496634749L; - // ======== 协议缺省值,当协议属性未设置时使用该缺省值替代 ======== + // ======== protocol default values, it'll take effect when protocol's attributes are not set ======== - // 服务IP地址(多网卡时使用) + // service IP addresses (used when there are multiple network cards available) private String host; - // 服务端口 + // service port private Integer port; - // 上下 + // context path private String contextpath; - // 线程池类型 + // thread pool private String threadpool; - // 线程池大小(固定大小) + // thread pool size (fixed size) private Integer threads; - // IO线程池大小(固定大小) + // IO thread pool size (fixed size) private Integer iothreads; - // 线程池队列大小 + // thread pool queue length private Integer queues; - // 最大接收连接数 + // max acceptable connections private Integer accepts; - // 协议编码 + // protocol codec private String codec; - // 序列化方式 + // serialization private String serialization; - // 字符集 + // charset private String charset; - // 最大请求数据长度 + // payload max length private Integer payload; - // 缓存区大小 + // buffer size private Integer buffer; - // 网络传输方式 + // transporter private String transporter; - // 信息交换方式 + // how information gets exchanged private String exchanger; - // 信息线程模型派发方式 + // thread dispatching mode private String dispatcher; - // 对称网络组网方式 + // networker private String networker; - // 服务器端实现 + // server impl private String server; - // 客户端实现 + // client impl private String client; - // 支持的telnet命令,多个命令用逗号分隔 + // supported telnet commands, separated with comma. private String telnet; - // 命令行提示符 + // command line prompt private String prompt; - // status检查 + // status check private String status; - // 停止时等候时间 + // wait time when stop private Integer wait; - // 是否为缺省 + // if it's default private Boolean isDefault; @Deprecated @@ -345,7 +345,7 @@ public void setExchanger(String exchanger) { } /** - * 单词拼写错误,请使用{@link #getDispatcher()} + * typo, switch to use {@link #getDispatcher()} * * @deprecated {@link #getDispatcher()} */ @@ -356,7 +356,7 @@ public String getDispather() { } /** - * 单词拼写错误,请使用{@link #setDispatcher(String)} + * typo, switch to use {@link #getDispatcher()} * * @deprecated {@link #setDispatcher(String)} */ diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java index 7a5cae800ab..f012526a519 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ReferenceConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -57,7 +58,6 @@ /** * ReferenceConfig * - * @author william.liangf * @export */ public class ReferenceConfig extends AbstractReferenceConfig { @@ -70,19 +70,19 @@ public class ReferenceConfig extends AbstractReferenceConfig { private static final ProxyFactory proxyFactory = ExtensionLoader.getExtensionLoader(ProxyFactory.class).getAdaptiveExtension(); private final List urls = new ArrayList(); - // 接口类型 + // interface name private String interfaceName; private Class interfaceClass; - // 客户端类型 + // client type private String client; - // 点对点直连服务提供地址 + // url for peer-to-peer invocation private String url; - // 方法配置 + // method configs private List methods; - // 缺省配置 + // default config private ConsumerConfig consumer; private String protocol; - // 接口代理类引用 + // interface proxy reference private transient volatile T ref; private transient volatile Invoker invoker; private transient volatile boolean initialized; @@ -96,7 +96,7 @@ protected void finalize() throws Throwable { if (!ReferenceConfig.this.destroyed) { logger.warn("ReferenceConfig(" + url + ") is not DESTROYED when FINALIZE"); - /* 先不做Destroy操作 + /* don't destroy for now try { ReferenceConfig.this.destroy(); } catch (Throwable t) { @@ -190,7 +190,7 @@ private void init() { if (interfaceName == null || interfaceName.length() == 0) { throw new IllegalStateException(" interface not allow null!"); } - // 获取消费者全局配置 + // get consumer's global configuration checkDefault(); appendProperties(this); if (getGeneric() == null && getConsumer() != null) { @@ -333,7 +333,7 @@ private void init() { StaticContext.getSystemContext().putAll(attributes); ref = createProxy(map); ConsumerModel consumerModel = new ConsumerModel(getUniqueServiceName(), this, ref, interfaceClass.getMethods()); - ApplicationModel.initConsumerModele(getUniqueServiceName(), consumerModel); + ApplicationModel.initConsumerModel(getUniqueServiceName(), consumerModel); } @SuppressWarnings({"unchecked", "rawtypes", "deprecation"}) @@ -344,7 +344,7 @@ private T createProxy(Map map) { if (url != null && url.length() > 0) { //指定URL的情况下,不做本地引用 isJvmRefer = false; } else if (InjvmProtocol.getInjvmProtocol().isInjvmRefer(tmpUrl)) { - //默认情况下如果本地有服务暴露,则引用本地服务. + // by default, reference local service if there is isJvmRefer = true; } else { isJvmRefer = false; @@ -360,7 +360,7 @@ private T createProxy(Map map) { logger.info("Using injvm service " + interfaceClass.getName()); } } else { - if (url != null && url.length() > 0) { // 用户指定URL,指定的URL可能是对点对直连地址,也可能是注册中心URL + if (url != null && url.length() > 0) { // user specified URL, could be peer-to-peer address, or register center's address. String[] us = Constants.SEMICOLON_SPLIT_PATTERN.split(url); if (us != null && us.length > 0) { for (String u : us) { @@ -375,7 +375,7 @@ private T createProxy(Map map) { } } } - } else { // 通过注册中心配置拼装URL + } else { // assemble URL from register center's configuration List us = loadRegistries(false); if (us != null && us.size() > 0) { for (URL u : us) { @@ -399,14 +399,14 @@ private T createProxy(Map map) { for (URL url : urls) { invokers.add(refprotocol.refer(interfaceClass, url)); if (Constants.REGISTRY_PROTOCOL.equals(url.getProtocol())) { - registryURL = url; // 用了最后一个registry url + registryURL = url; // use last registry url } } - if (registryURL != null) { // 有 注册中心协议的URL - // 对有注册中心的Cluster 只用 AvailableCluster + if (registryURL != null) { // registry url is available + // use AvailableCluster only when register's cluster is available URL u = registryURL.addParameter(Constants.CLUSTER_KEY, AvailableCluster.NAME); invoker = cluster.join(new StaticDirectory(u, invokers)); - } else { // 不是 注册中心的URL + } else { // not a registry url invoker = cluster.join(new StaticDirectory(invokers)); } } @@ -425,7 +425,7 @@ private T createProxy(Map map) { if (logger.isInfoEnabled()) { logger.info("Refer dubbo service " + interfaceClass.getName() + " from url " + invoker.getUrl()); } - // 创建服务代理 + // create service proxy return (T) proxyFactory.getProxy(invoker); } diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java index ba5da978569..7e2672b9c30 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/RegistryConfig.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -24,29 +25,28 @@ /** * RegistryConfig * - * @author william.liangf * @export */ public class RegistryConfig extends AbstractConfig { public static final String NO_AVAILABLE = "N/A"; private static final long serialVersionUID = 5508512956753757169L; - // 注册中心地址 + // register center address private String address; - // 注册中心登录用户名 + // username to login register center private String username; - // 注册中心登录密码 + // password to login register center private String password; - // 注册中心缺省端口 + // default port for register center private Integer port; - // 注册中心协议 + // protocol for register center private String protocol; - // 客户端实现 + // client impl private String transporter; private String server; @@ -59,34 +59,34 @@ public class RegistryConfig extends AbstractConfig { private String version; - // 注册中心请求超时时间(毫秒) + // request timeout in milliseconds for register center private Integer timeout; - // 注册中心会话超时时间(毫秒) + // session timeout in milliseconds for register center private Integer session; - // 动态注册中心列表存储文件 + // file for saving register center dynamic list private String file; - // 停止时等候完成通知时间 + // wait time before stop private Integer wait; - // 启动时检查注册中心是否存在 + // whether to check if register center is available when boot up private Boolean check; - // 在该注册中心上注册是动态的还是静态的服务 + // whether to allow dynamic service to register on the register center private Boolean dynamic; - // 在该注册中心上服务是否暴露 + // whether to export service on the register center private Boolean register; - // 在该注册中心上服务是否引用 + // whether allow to subscribe service on the register center private Boolean subscribe; - // 自定义参数 + // customized parameters private Map parameters; - // 是否为缺省 + // if it's default private Boolean isDefault; public RegistryConfig() { diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java index 969d37ff822..4e90271f5b1 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java @@ -1,11 +1,12 @@ /* - * Copyright 1999-2011 Alibaba Group. + * 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 * - * Licensed 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 + * 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, @@ -63,7 +64,6 @@ /** * ServiceConfig * - * @author william.liangf * @export */ public class ServiceConfig extends AbstractServiceConfig { @@ -79,14 +79,14 @@ public class ServiceConfig extends AbstractServiceConfig { private static final ScheduledExecutorService delayExportExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("DubboServiceDelayExporter", true)); private final List urls = new ArrayList(); private final List> exporters = new ArrayList>(); - // 接口类型 + // interface type private String interfaceName; private Class interfaceClass; - // 接口实现类引用 + // reference to interface impl private T ref; - // 服务名称 + // service name private String path; - // 方法配置 + // method configuration private List methods; private ProviderConfig provider; private transient volatile boolean exported; @@ -318,7 +318,7 @@ protected synchronized void doExport() { } private void checkRef() { - // 检查引用不为空,并且引用必需实现接口 + // reference should not be null, and is the implementation of the given interface if (ref == null) { throw new IllegalStateException("ref not allow null!"); } @@ -395,10 +395,10 @@ private void doExportUrlsFor1Protocol(ProtocolConfig protocolConfig, List r if (methods != null && methods.length > 0) { for (int i = 0; i < methods.length; i++) { String methodName = methods[i].getName(); - //匹配方法名称,获取方法签名. + // target the method, and get its signature if (methodName.equals(method.getName())) { Class[] argtypes = methods[i].getParameterTypes(); - //一个方法中单个callback + // one callback in the method if (argument.getIndex() != -1) { if (argtypes[argument.getIndex()].getName().equals(argument.getType())) { appendParameters(map, argument, method.getName() + "." + argument.getIndex()); @@ -406,7 +406,7 @@ private void doExportUrlsFor1Protocol(ProtocolConfig protocolConfig, List r throw new IllegalArgumentException("argument config error : the index attribute and type attirbute not match :index :" + argument.getIndex() + ", type:" + argument.getType()); } } else { - //一个方法中多个callback + // multiple callbacks in the method for (int j = 0; j < argtypes.length; j++) { Class argclazz = argtypes[j]; if (argclazz.getName().equals(argument.getType())) { @@ -459,7 +459,7 @@ private void doExportUrlsFor1Protocol(ProtocolConfig protocolConfig, List r protocolConfig.setRegister(false); map.put("notify", "false"); } - // 导出服务 + // export service String contextPath = protocolConfig.getContextpath(); if ((contextPath == null || contextPath.length() == 0) && provider != null) { contextPath = provider.getContextpath(); @@ -476,14 +476,14 @@ private void doExportUrlsFor1Protocol(ProtocolConfig protocolConfig, List r } String scope = url.getParameter(Constants.SCOPE_KEY); - //配置为none不暴露 + // don't export when none is configured if (!Constants.SCOPE_NONE.toString().equalsIgnoreCase(scope)) { - //配置不是remote的情况下做本地暴露 (配置为remote,则表示只暴露远程服务) + // export to local if the config is not remote (export to remote only when config is remote) if (!Constants.SCOPE_REMOTE.toString().equalsIgnoreCase(scope)) { exportLocal(url); } - //如果配置不是local则暴露为远程服务.(配置为local,则表示只暴露本地服务) + // export to remote if the config is not local (export to local only when config is local) if (!Constants.SCOPE_LOCAL.toString().equalsIgnoreCase(scope)) { if (logger.isInfoEnabled()) { logger.info("Export dubbo service " + interfaceClass.getName() + " to url " + url); @@ -532,8 +532,9 @@ private void exportLocal(URL url) { /** - * provider注册&监听ip地址,注册与监听ip可独立配置 - * 配置优先级:系统环境变量 -> java命令参数-D -> 配置文件host属性 -> /etc/hosts中hostname-ip映射关系 -> 默认联通注册中心地址的网卡地址 -> 第一个可用的网卡地址 + * Register & bind IP address for service provider, can be configured separately. + * Configuration priority: environment variables -> java system properties -> host property in config file -> + * /etc/hosts -> default network address -> first available network address * * @param protocolConfig * @param registryURLs @@ -548,7 +549,7 @@ private String findConfigedHosts(ProtocolConfig protocolConfig, List regist throw new IllegalArgumentException("Specified invalid bind ip from property:" + Constants.DUBBO_IP_TO_BIND + ", value:" + hostToBind); } - // 如果没通过环境变量设置bind ip,则继续按优先级查找 + // if bind ip is not found in environment, keep looking up if (hostToBind == null || hostToBind.length() == 0) { hostToBind = protocolConfig.getHost(); if (provider != null && (hostToBind == null || hostToBind.length() == 0)) { @@ -591,12 +592,12 @@ private String findConfigedHosts(ProtocolConfig protocolConfig, List regist map.put(Constants.BIND_IP_KEY, hostToBind); - // registry ip,默认不作为bind ip + // registry ip is not used for bind ip by default String hostToRegistry = getValueFromConfig(protocolConfig, Constants.DUBBO_IP_TO_REGISTRY); if (hostToRegistry != null && hostToRegistry.length() > 0 && isInvalidLocalHost(hostToRegistry)) { throw new IllegalArgumentException("Specified invalid registry ip from property:" + Constants.DUBBO_IP_TO_REGISTRY + ", value:" + hostToRegistry); } else if (hostToRegistry == null || hostToRegistry.length() == 0) { - // bind ip默认作为registry ip + // bind ip is used as registry ip by default hostToRegistry = hostToBind; } @@ -606,8 +607,9 @@ private String findConfigedHosts(ProtocolConfig protocolConfig, List regist } /** - * provider注册&监听端口,注册与监听port可独立配置 - * 配置优先级:启动环境变量 -> java命令参数-D -> protocol配置文件port属性配置 -> 协议默认端口 + * Register port and bind port for the provider, can be configured separately + * Configuration priority: environment variable -> java system properties -> port property in protocol config file + * -> protocol default port * * @param protocolConfig * @param name @@ -616,11 +618,11 @@ private String findConfigedHosts(ProtocolConfig protocolConfig, List regist private Integer findConfigedPorts(ProtocolConfig protocolConfig, String name, Map map) { Integer portToBind = null; - // 解析环境变量配置的bind port + // parse bind port from environment String port = getValueFromConfig(protocolConfig, Constants.DUBBO_PORT_TO_BIND); portToBind = parsePort(port); - // 如未通过环境变量配置bind port,则继续按优先级查找 + // if there's no bind port found from environment, keep looking up. if (portToBind == null) { portToBind = protocolConfig.getPort(); if (provider != null && (portToBind == null || portToBind == 0)) { @@ -640,10 +642,10 @@ private Integer findConfigedPorts(ProtocolConfig protocolConfig, String name, Ma } } - // 记录bind port,作为url的key + // save bind port, used as url's key later map.put(Constants.BIND_PORT_KEY, String.valueOf(portToBind)); - // registry port,默认不作为bind port + // registry port, not used as bind port by default String portToRegistryStr = getValueFromConfig(protocolConfig, Constants.DUBBO_PORT_TO_REGISTRY); Integer portToRegistry = parsePort(portToRegistryStr); if (portToRegistry == null) { @@ -690,7 +692,7 @@ private void checkProtocol() { && provider != null) { setProtocols(provider.getProtocols()); } - // 兼容旧版本 + // backward compatibility if (protocols == null || protocols.size() == 0) { setProtocol(new ProtocolConfig()); } diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java index d20275e9b75..7ce2b6e04ef 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Reference.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -24,7 +25,6 @@ /** * Reference * - * @author william.liangf * @export */ @Documented diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java index 1e30f4bd354..322bce37a09 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/annotation/Service.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -25,7 +26,6 @@ /** * Service * - * @author william.liangf * @export */ @Documented diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvoker.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvoker.java index 2345d124eff..14bfa502158 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvoker.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/invoker/DelegateProviderMetaDataInvoker.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.config.invoker; import com.alibaba.dubbo.common.URL; @@ -7,10 +23,6 @@ import com.alibaba.dubbo.rpc.Result; import com.alibaba.dubbo.rpc.RpcException; -/** - * @author qinliujie - * @date 2017/11/22 - */ public class DelegateProviderMetaDataInvoker implements Invoker { protected final Invoker invoker; private ServiceConfig metadata; diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ApplicationModel.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ApplicationModel.java index 86327693faa..47160291ff3 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ApplicationModel.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ApplicationModel.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.config.model; import com.alibaba.dubbo.common.logger.Logger; @@ -12,22 +28,17 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -/** - * @author qinliujie - * @date 2017/11/22 - */ - -//TODO 需要调整项目结构,才能使用后面的方法 +// TODO need to adjust project structure in order to fully utilize the methods introduced here. public class ApplicationModel { protected static final Logger logger = LoggerFactory.getLogger(ApplicationModel.class); /** - * 全限定名到提供的服务 + * full qualified class name -> provided service */ private static final ConcurrentMap providedServices = new ConcurrentHashMap(); /** - * 全限定名到订阅的服务 + * full qualified class name -> subscribe service */ private static final ConcurrentMap consumedServices = new ConcurrentHashMap(); @@ -49,7 +60,7 @@ public static List allProviderModels() { return new ArrayList(providedServices.values()); } - public static boolean initConsumerModele(String serviceName, ConsumerModel consumerModel) { + public static boolean initConsumerModel(String serviceName, ConsumerModel consumerModel) { if (consumedServices.putIfAbsent(serviceName, consumerModel) != null) { logger.warn("Already register the same consumer:" + serviceName); return false; diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerMethodModel.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerMethodModel.java index 50a403bcc03..c3252847127 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerMethodModel.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerMethodModel.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.config.model; import com.alibaba.dubbo.common.Constants; @@ -5,10 +21,6 @@ import java.lang.reflect.Method; -/** - * @author qinliujie - * @date 2017/11/22 - */ public class ConsumerMethodModel { private final Method method; private final ReferenceConfig metadata; @@ -52,9 +64,6 @@ public ReferenceConfig getMetadata() { return metadata; } - /** - * 获取参数类型 - */ private String[] createParamSignature(Class[] args) { if (args == null || args.length == 0) { return new String[] {}; diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerModel.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerModel.java index cfc7640551d..776d903a4bf 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerModel.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ConsumerModel.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.config.model; import com.alibaba.dubbo.config.ReferenceConfig; @@ -8,10 +24,6 @@ import java.util.List; import java.util.Map; -/** - * @author qinliujie - * @date 2017/11/22 - */ public class ConsumerModel { private ReferenceConfig metadata; private Object proxyObject; @@ -32,9 +44,9 @@ public ConsumerModel(String serviceName,ReferenceConfig metadata, Object proxyOb } /** - * 返回消费服务对应的元数据 + * Return service metadata for consumer * - * @return 服务元数据 + * @return service metadata */ public ReferenceConfig getMetadata() { return metadata; @@ -45,19 +57,19 @@ public Object getProxyObject() { } /** - * 根据用户调用的方法对象,返回消费的方法模型 + * Return method model for the given method on consumer side * - * @param method 反射的方法对象 - * @return 方法模型 + * @param method method object + * @return method model */ public ConsumerMethodModel getMethodModel(Method method) { return methodModels.get(method); } /** - * 返回当前服务下的所有方法模型 + * Return all method models for the current service * - * @return 方法列表,不会为空 + * @return method model list */ public List getAllMethods() { return new ArrayList(methodModels.values()); diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderMethodModel.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderMethodModel.java index 922a78457bb..524718d3dcb 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderMethodModel.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderMethodModel.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.config.model; import java.lang.reflect.Method; diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderModel.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderModel.java index aaf8daffc21..1dbe988f39b 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderModel.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/model/ProviderModel.java @@ -1,3 +1,19 @@ +/* + * 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 com.alibaba.dubbo.config.model; import com.alibaba.dubbo.config.ServiceConfig; @@ -9,10 +25,6 @@ import java.util.List; import java.util.Map; -/** - * @author qinliujie - * @date 2017/11/22 - */ public class ProviderModel { private final String serviceName; private final Object serviceInstance; @@ -21,7 +33,7 @@ public class ProviderModel { public ProviderModel(String serviceName, ServiceConfig metadata, Object serviceInstance) { if (null == serviceInstance) { - throw new IllegalArgumentException("Servie[" + serviceName + "]Target is NULL."); + throw new IllegalArgumentException("Service[" + serviceName + "]Target is NULL."); } this.serviceName = serviceName; diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/support/Parameter.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/support/Parameter.java index f2a9effdf67..9a392d305e0 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/support/Parameter.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/support/Parameter.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -23,8 +24,6 @@ /** * Parameter - * - * @author william.liangf */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/utils/ReferenceConfigCache.java b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/utils/ReferenceConfigCache.java index 9cb2b3fb090..9e5f759c768 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/utils/ReferenceConfigCache.java +++ b/dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/utils/ReferenceConfigCache.java @@ -1,11 +1,12 @@ /* - * Copyright 1999-2011 Alibaba Group. + * 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 * - * Licensed 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 + * 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, @@ -30,8 +31,6 @@ * for the framework which create {@link ReferenceConfig} frequently. *

* You can implement and use your own {@link ReferenceConfig} cache if you need use complicate strategy. - * - * @author ding.lid */ public class ReferenceConfigCache { public static final String DEFAULT_NAME = "_DEFAULT_"; diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java index 34d1209df00..64bc6adbd6e 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/GenericServiceTest.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -42,8 +43,6 @@ /** * GenericServiceTest - * - * @author william.liangf */ public class GenericServiceTest { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ReferenceConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ReferenceConfigTest.java index e0cdfcb60fc..888dc017cc7 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ReferenceConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/ReferenceConfigTest.java @@ -1,11 +1,12 @@ /* - * Copyright 1999-2012 Alibaba Group. + * 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 * - * Licensed 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 + * 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, @@ -22,9 +23,6 @@ import junit.framework.Assert; import org.junit.Test; -/** - * @author kimi - */ public class ReferenceConfigTest { @Test diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java index dc61bc00e48..d4d5d21628b 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/RpcConfigGetSetProxy.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -22,9 +23,6 @@ import java.lang.reflect.Method; -/** - * @author haomin.liuhm - */ public class RpcConfigGetSetProxy { private static final String RPC_CONFIG_BASECLASS = AbstractConfig.class.getName(); diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Box.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Box.java index 87397928c7d..e1158578987 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Box.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/Box.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -15,9 +16,6 @@ */ package com.alibaba.dubbo.config.api; -/** - * @author ding.lid - */ public interface Box { String getName(); diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoException.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoException.java index a380653cff8..370a14d5ce9 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoException.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoException.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -17,8 +18,6 @@ /** * DemoException - * - * @author william.liangf */ public class DemoException extends Exception { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoService.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoService.java index 41b94ca8ee9..655d192927f 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoService.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/DemoService.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -20,8 +21,6 @@ /** * DemoService - * - * @author william.liangf */ public interface DemoService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/User.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/User.java index 895593b3f47..332042f200f 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/User.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/api/User.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -19,8 +20,6 @@ /** * User - * - * @author william.liangf */ public class User implements Serializable { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheService.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheService.java index d48a172ed97..af7a4bed7ac 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheService.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheService.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -17,8 +18,6 @@ /** * ValidationService - * - * @author william.liangf */ public interface CacheService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheServiceImpl.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheServiceImpl.java index 4afc3debc94..6485907d4f2 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheServiceImpl.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheServiceImpl.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -19,8 +20,6 @@ /** * ValidationServiceImpl - * - * @author william.liangf */ public class CacheServiceImpl implements CacheService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java index eddc21ae995..7632d3b28f5 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/cache/CacheTest.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -27,8 +28,6 @@ /** * CacheTest - * - * @author william.liangf */ public class CacheTest extends TestCase { @@ -48,7 +47,8 @@ public void testCache() throws Exception { reference.setUrl("dubbo://127.0.0.1:29582?scope=remote&cache=true"); CacheService cacheService = reference.get(); try { - // 测试缓存生效,多次调用返回同样的结果。(服务器端自增长返回值) + // verify cache, same result is returned for multiple invocations (in fact, the return value increases + // on every invocation on the server side) String fix = null; for (int i = 0; i < 3; i++) { String result = cacheService.findCache("0"); @@ -57,7 +57,7 @@ public void testCache() throws Exception { Thread.sleep(100); } - // LRU的缺省cache.size为1000,执行1001次,应有溢出 + // default cache.size is 1000 for LRU, should have cache expired if invoke more than 1001 times for (int n = 0; n < 1001; n++) { String pre = null; for (int i = 0; i < 10; i++) { @@ -67,7 +67,7 @@ public void testCache() throws Exception { } } - // 测试LRU有移除最开始的一个缓存项 + // verify if the first cache item is expired in LRU cache String result = cacheService.findCache("0"); Assert.assertFalse(fix == null || fix.equals(result)); } finally { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionByAnnotation.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionByAnnotation.java index 3ab1da156fd..1c91ecb7fa8 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionByAnnotation.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionByAnnotation.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -21,8 +22,6 @@ /** * DemoAction - * - * @author william.liangf */ public class DemoActionByAnnotation { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionBySetter.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionBySetter.java index f8ea94522d5..8a46b30614a 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionBySetter.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoActionBySetter.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -19,8 +20,6 @@ /** * DemoAction - * - * @author william.liangf */ public class DemoActionBySetter { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoInterceptor.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoInterceptor.java index 9d68682d20f..abd4162de88 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoInterceptor.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/consumer/DemoInterceptor.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -20,8 +21,6 @@ /** * DemoInterceptor - * - * @author william.liangf */ public class DemoInterceptor implements MethodInterceptor { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl.java index a0112b90b91..4ffc1dee805 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -24,8 +25,6 @@ /** * DemoServiceImpl - * - * @author william.liangf */ public class DemoServiceImpl implements DemoService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java index 9d77f0b8794..70ec71bc9c8 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/DemoServiceImpl_LongWaiting.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -24,8 +25,6 @@ /** * DemoServiceImpl - * - * @author william.liangf */ public class DemoServiceImpl_LongWaiting implements DemoService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java index fdeef8746b0..9a6437e6f40 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBox.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -17,9 +18,6 @@ import com.alibaba.dubbo.config.api.Box; -/** - * @author ding.lid - */ public class UnserializableBox implements Box { private static final long serialVersionUID = -4141012025649711421L; diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java index 1a3d0445af0..ee93600f966 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/provider/impl/UnserializableBoxDemoServiceImpl.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -24,8 +25,6 @@ /** * DemoServiceImpl - * - * @author william.liangf */ public class UnserializableBoxDemoServiceImpl implements DemoService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java index 08f1244a505..aabbbf9757d 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockProtocol.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -23,9 +24,6 @@ import com.alibaba.dubbo.rpc.Result; import com.alibaba.dubbo.rpc.RpcException; -/** - * @author haomin.liuhm - */ public class MockProtocol implements Protocol { /* (non-Javadoc) diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java index 7db71b92d8a..c63b504b1b0 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistry.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -25,8 +26,6 @@ /** * TODO Comment of MockRegistry - * - * @author haomin.liuhm */ public class MockRegistry implements Registry { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java index 852fdb13d90..b08b427c961 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/support/MockRegistryFactory.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -21,8 +22,6 @@ /** * TODO Comment of MockRegistryFactory - * - * @author haomin.liuhm */ public class MockRegistryFactory implements RegistryFactory { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java index c3c2fc2f570..7fbfa4cc722 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/ExporterSideConfigUrlTest.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -27,10 +28,6 @@ import java.io.UnsupportedEncodingException; import java.net.URLDecoder; - -/** - * @author haomin.liuhm - */ public class ExporterSideConfigUrlTest extends UrlTestBase { private static final Logger log = LoggerFactory.getLogger(ExporterSideConfigUrlTest.class); diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java index 4061795c56a..e05ae460566 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/InvokerSideConfigUrlTest.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -35,9 +36,6 @@ import java.util.Arrays; -/** - * @author haomin.liuhm - */ public class InvokerSideConfigUrlTest extends UrlTestBase { private static final Logger log = LoggerFactory.getLogger(InvokerSideConfigUrlTest.class); @@ -170,8 +168,8 @@ public void refConfUrlTest() { verifyInvokerUrlGeneration(refConf, refConfTable); } - @Ignore - @Test //注册中心的参数不会在与consumer的query merge + @Ignore("parameter on register center will not be merged any longer with query parameter request from the consumer") + @Test public void regConfForConsumerUrlTest() { verifyInvokerUrlGeneration(regConfForConsumer, regConfForConsumerTable); @@ -225,7 +223,6 @@ private void verifyInvokerUrlGeneration(T config, Object[][] dataTable) { assertUrlStringWithLocalTable(subScribedUrlStr, dataTable, configName, column); - //重新refer会判断如果已经订阅过,不再重新订阅。 try { refConf.destroy(); } catch (Exception e) { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java index 827801f14d5..2f1331e835c 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/url/test/UrlTestBase.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2011 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -32,10 +33,6 @@ import java.util.Arrays; -/** - * @author haomin.liuhm - */ - @SuppressWarnings("unused") public class UrlTestBase { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/MockReferenceConfig.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/MockReferenceConfig.java index b39fa859048..cad6453d8a6 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/MockReferenceConfig.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/MockReferenceConfig.java @@ -1,11 +1,12 @@ /* - * Copyright 1999-2011 Alibaba Group. + * 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 * - * Licensed 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 + * 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, @@ -19,9 +20,6 @@ import java.util.concurrent.atomic.AtomicLong; -/** - * @author ding.lid - */ public class MockReferenceConfig extends ReferenceConfig { static AtomicLong counter = new AtomicLong(); diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java index 89c96b97812..231d56b1c98 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/utils/ReferenceConfigCacheTest.java @@ -1,11 +1,12 @@ /* - * Copyright 1999-2011 Alibaba Group. + * 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 * - * Licensed 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 + * 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, @@ -22,9 +23,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -/** - * @author ding.lid - */ public class ReferenceConfigCacheTest { @Before public void setUp() throws Exception { @@ -109,7 +107,8 @@ public void testGetCache_DiffName() throws Exception { config.setVersion("1.0.0"); String value = cache.get(config); - assertTrue(config.isGetMethodRun()); // 不同的Cache,相同的ReferenceConfig也会Init + // still init for the same ReferenceConfig if the cache is different + assertTrue(config.isGetMethodRun()); assertEquals("1", value); } } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationParameter.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationParameter.java index ca80f66103b..f5b7296e3b6 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationParameter.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationParameter.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -27,8 +28,6 @@ /** * ValidationParameter - * - * @author william.liangf */ public class ValidationParameter implements Serializable { @@ -37,22 +36,23 @@ public class ValidationParameter implements Serializable { @NotNull(groups = ValidationService.Update.class) private Integer id; - @NotNull // 不允许为空 - @Size(min = 2, max = 20) // 长度或大小范围 + @NotNull + @Size(min = 2, max = 20) private String name; - @NotNull(groups = ValidationService.Save.class) // 保存时不允许为空,更新时允许为空 ,表示不更新该字段 + // not allow to save null, but allow to update with null which means not update the field + @NotNull(groups = ValidationService.Save.class) @Pattern(regexp = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$") private String email; - @Min(18) // 最小值 - @Max(100) // 最大值 + @Min(18) + @Max(100) private int age; - @Past // 必须为一个过去的时间 + @Past private Date loginDate; - @Future // 必须为一个未来的时间 + @Future private Date expiryDate; public Integer getId() { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationService.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationService.java index eb9ea2d35ed..a85afba7824 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationService.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationService.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -25,14 +26,14 @@ /** * ValidationService - * - * @author william.liangf + *

+ * Use service interface to distinguish validation scenario, for example: @NotNull(groups = ValidationService.class) */ -public interface ValidationService { // 缺省可按服务接口区分验证场景,如:@NotNull(groups = ValidationService.class) +public interface ValidationService { /** - * 没有加上“@MethodValidated(ValidationService.Save.class)”这句代码时, - * 现在的检查逻辑不会去检验groups = ValidationService.Save.class这个分组 + * The current logic will not verify 'groups = ValidationService.Save.class' if + * '@MethodValidated(ValidationService.Save.class)' is not present * * @param parameter */ @@ -44,17 +45,26 @@ public interface ValidationService { // 缺省可按服务接口区分验证场 void delete(@Min(1) long id, @NotNull @Size(min = 2, max = 16) @Pattern(regexp = "^[a-zA-Z]+$") String operator); /** - * 假设关联查询的时候需要同时传id和email的值。这时需要检查Sava分组和Update分组。 + * Assume both id and email are needed to pass in, need to verify Save group and Update group. + * * @param parameter */ @MethodValidated({Save.class, Update.class}) void relatedQuery(ValidationParameter parameter); + /** + * annotation which has the same name with the method but has the first letter in capital + * used for distinguish validation scenario, for example: @NotNull(groups = ValidationService.Save.class) + * optional + */ @interface Save { - } // 与方法同名接口,首字母大写,用于区分验证场景,如:@NotNull(groups = ValidationService.Save.class),可选 + } + /** + * annotation which has the same name with the method but has the first letter in capital + * used for distinguish validation scenario, for example: @NotNull(groups = ValidationService.Update.class) + * optional + */ @interface Update { - } // 与方法同名接口,首字母大写,用于区分验证场景,如:@NotNull(groups = ValidationService.Update.class),可选 - - + } } diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationServiceImpl.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationServiceImpl.java index 2fc0a106ae7..42720668ffb 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationServiceImpl.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationServiceImpl.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -17,8 +18,6 @@ /** * ValidationServiceImpl - * - * @author william.liangf */ public class ValidationServiceImpl implements ValidationService { diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationTest.java index 7a90dc9af42..e9415cad4e2 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/validation/ValidationTest.java @@ -1,12 +1,13 @@ /* - * Copyright 1999-2012 Alibaba Group. - * - * Licensed 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 - * + * 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. @@ -35,8 +36,6 @@ /** * GenericServiceTest - * - * @author william.liangf */ public class ValidationTest { @@ -81,7 +80,7 @@ public void testValidation() { Assert.assertNotNull(violations); } - //检查Save分组 save error + // verify save group, save error try { parameter = new ValidationParameter(); parameter.setName("liangfei"); @@ -96,7 +95,8 @@ public void testValidation() { Assert.assertNotNull(violations); } - // relatedQuery error 不传id和email的值,触发Save和Update的检查异常 + // relatedQuery error, no id and email is passed, will trigger validation exception for both Save + // and Update try { parameter = new ValidationParameter(); parameter.setName("liangfei"); diff --git a/dubbo-config/dubbo-config-api/src/test/resources/log4j.xml b/dubbo-config/dubbo-config-api/src/test/resources/log4j.xml index 52899b3c560..d63a6bffc1b 100644 --- a/dubbo-config/dubbo-config-api/src/test/resources/log4j.xml +++ b/dubbo-config/dubbo-config-api/src/test/resources/log4j.xml @@ -1,18 +1,18 @@ -