From 8e29a348a934adc1e8aeb565eaa933a3b55c989e Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 7 May 2019 21:24:57 +0800 Subject: [PATCH] Deleted the chinese comments --- .../alibaba/nacos/naming/core/Cluster.java | 38 +++++++++---------- .../nacos/naming/misc/UtilsAndCommons.java | 15 ++++---- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/Cluster.java b/naming/src/main/java/com/alibaba/nacos/naming/core/Cluster.java index 0fd97eb1b..76bc9c04b 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/Cluster.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/Cluster.java @@ -64,13 +64,13 @@ public class Cluster extends com.alibaba.nacos.api.naming.pojo.Cluster implement /** * Create a cluster. - *

集群名不能为空,且只能由阿拉伯数字,英文字母和减号(-)组成(the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed)。 + *

the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed. * - * @param clusterName 集群名 - * @param service 服务 - * @throws IllegalArgumentException 服务为空,或者集群名为空,或者集群名不合法(the service is null, or the cluster name is null, or the cluster name is illegal)。 - * @since 1.1.0 + * @param clusterName the cluster name + * @param service the service to which the current cluster belongs + * @throws IllegalArgumentException the service is null, or the cluster name is null, or the cluster name is illegal * @author jifengnan 2019-04-26 + * @since 1.0.1 */ public Cluster(String clusterName, Service service) { this.setName(clusterName); @@ -125,14 +125,12 @@ public class Cluster extends com.alibaba.nacos.api.naming.pojo.Cluster implement } /** - * 为当前的集群更换服务(replace the service for the current cluster)。 - *

不建议使用,集群所属的服务不应该允许被更改(服务内部的可变属性可以更改,但不应该将一个A服务的集群改成B服务)。 - * 如果一个集群对应的服务都变了,其实应该新建一个集群。 - * (Deprecated because the service shouldn't be replaced. + * Replace the service for the current cluster. + *

Deprecated because the service shouldn't be replaced. * (the service fields can be changed, but the service A shouldn't be replaced to service B). - * If the service of a cluster is required to replace, actually, a new cluster is required) + * If the service of a cluster is required to replace, actually, a new cluster is required. * - * @param service 服务 + * @param service the new service */ @Deprecated public void setService(Service service) { @@ -140,12 +138,11 @@ public class Cluster extends com.alibaba.nacos.api.naming.pojo.Cluster implement } /** - * 该方法计划在未来被移除,服务名不应允许被更改。 - * (this method has been deprecated, the service name is not allowed to change)。 + * this method has been deprecated, the service name is not allowed to change. * - * @param serviceName 服务名 - * @since 1.1.0 + * @param serviceName the service name * @author jifengnan 2019-04-26 + * @since 1.0.1 */ @Deprecated @Override @@ -155,9 +152,8 @@ public class Cluster extends com.alibaba.nacos.api.naming.pojo.Cluster implement /** * Get the service name of the current cluster. - *

注意,通过本方法获取的服务名并非是通过{@link #setServiceName(String)}设置的服务名,而是当前集群所属服务的名字。 - * (Note that the returned service name is not the name which set by {@link #setServiceName(String)}, - * but the name of the service to which the current cluster belongs). + *

Note that the returned service name is not the name which set by {@link #setServiceName(String)}, + * but the name of the service to which the current cluster belongs. * * @return the service name of the current cluster. */ @@ -389,10 +385,10 @@ public class Cluster extends com.alibaba.nacos.api.naming.pojo.Cluster implement } /** - * 验证当前集群是否合法(validate the current cluster)。 - *

集群名不能为空,且只能由阿拉伯数字,英文字母和减号(-)组成(the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed)。 + * validate the current cluster. + *

the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed. * - * @throws IllegalArgumentException 服务为空,或者集群名为空,或者集群名不合法(the service is null, or the cluster name is null, or the cluster name is illegal)。 + * @throws IllegalArgumentException the service is null, or the cluster name is null, or the cluster name is illegal */ public void validate() { Assert.notNull(getName(), "cluster name cannot be null"); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/misc/UtilsAndCommons.java b/naming/src/main/java/com/alibaba/nacos/naming/misc/UtilsAndCommons.java index 03e7703b0..c19bf4c17 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/misc/UtilsAndCommons.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/misc/UtilsAndCommons.java @@ -240,21 +240,22 @@ public class UtilsAndCommons { } /** - * 根据指定的字符串计算出一个0(含)到{@code upperLimit}(不含)之间的数字,本方法会试图让不同的字符串较均匀的分布在0到{@code upperLimit}之间。 - * (Provide a number between 0(inclusive) and {@code upperLimit}(exclusive) for the given {@code string}, the number will be nearly uniform distribution.) + * Provide a number between 0(inclusive) and {@code upperLimit}(exclusive) for the given {@code string}, + * the number will be nearly uniform distribution. *

*

- * 举个例子:假设有N个提供相同服务的服务器地址被存在一个数组中,为了实现负载均衡,可以根据调用者的名字决定使用哪个服务器。 - * (e.g. Assume there's an array which contains some IP of the servers provide the same service, the caller name can be used to choose the server to achieve load balance.) + * + * e.g. Assume there's an array which contains some IP of the servers provide the same service, + * the caller name can be used to choose the server to achieve load balance. *

      *     String[] serverIps = new String[10];
      *     int index = shakeUp("callerName", serverIps.length);
      *     String targetServerIp = serverIps[index];
      * 
* - * @param string 字符串。如果为null会固定返回0 (a string. the number 0 will be returned if it's null) - * @param upperLimit 返回值的上限,必须为正整数(>0) (the upper limit of the returned number, must be a positive integer, which means > 0) - * @return 0(含)到upperLimit(不含)之间的一个数字 (a number between 0(inclusive) and upperLimit(exclusive)) + * @param string a string. the number 0 will be returned if it's null + * @param upperLimit the upper limit of the returned number, must be a positive integer, which means > 0 + * @return a number between 0(inclusive) and upperLimit(exclusive) * @throws IllegalArgumentException if the upper limit equals or less than 0 * @since 1.0.0 * @author jifengnan