Deleted the chinese comments

This commit is contained in:
Andy 2019-05-07 21:24:57 +08:00
parent 4fd773b534
commit 8e29a348a9
2 changed files with 25 additions and 28 deletions

View File

@ -64,13 +64,13 @@ public class Cluster extends com.alibaba.nacos.api.naming.pojo.Cluster implement
/** /**
* Create a cluster. * Create a cluster.
* <p>集群名不能为空且只能由阿拉伯数字英文字母和减号-组成(the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed) * <p>the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed.
* *
* @param clusterName 集群名 * @param clusterName the cluster name
* @param service 服务 * @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) * @throws IllegalArgumentException the service is null, or the cluster name is null, or the cluster name is illegal
* @since 1.1.0
* @author jifengnan 2019-04-26 * @author jifengnan 2019-04-26
* @since 1.0.1
*/ */
public Cluster(String clusterName, Service service) { public Cluster(String clusterName, Service service) {
this.setName(clusterName); 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 * Replace the service for the current cluster.
* <p>不建议使用集群所属的服务不应该允许被更改服务内部的可变属性可以更改但不应该将一个A服务的集群改成B服务 * <p>Deprecated because the service shouldn't be replaced.
* 如果一个集群对应的服务都变了其实应该新建一个集群
* (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). * (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 @Deprecated
public void setService(Service service) { 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 服务名 * @param serviceName the service name
* @since 1.1.0
* @author jifengnan 2019-04-26 * @author jifengnan 2019-04-26
* @since 1.0.1
*/ */
@Deprecated @Deprecated
@Override @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. * Get the service name of the current cluster.
* <p>注意通过本方法获取的服务名并非是通过{@link #setServiceName(String)}设置的服务名而是当前集群所属服务的名字 * <p>Note that the returned service name is not the name which set by {@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.
* but the name of the service to which the current cluster belongs).
* *
* @return the service name of the current cluster. * @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) * validate the current cluster.
* <p>集群名不能为空且只能由阿拉伯数字英文字母和减号-组成(the cluster name cannot be null, and only the arabic numerals, letters and endashes are allowed) * <p>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() { public void validate() {
Assert.notNull(getName(), "cluster name cannot be null"); Assert.notNull(getName(), "cluster name cannot be null");

View File

@ -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},
* (Provide a number between 0(inclusive) and {@code upperLimit}(exclusive) for the given {@code string}, the number will be nearly uniform distribution.) * the number will be nearly uniform distribution.
* <p> * <p>
* <p> * <p>
* 举个例子假设有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.
* <blockquote><pre> * <blockquote><pre>
* String[] serverIps = new String[10]; * String[] serverIps = new String[10];
* int index = shakeUp("callerName", serverIps.length); * int index = shakeUp("callerName", serverIps.length);
* String targetServerIp = serverIps[index]; * String targetServerIp = serverIps[index];
* </pre></blockquote> * </pre></blockquote>
* *
* @param string 字符串如果为null会固定返回0 (a string. the number 0 will be returned if it's null) * @param string 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) * @param upperLimit 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)) * @return a number between 0(inclusive) and upperLimit(exclusive)
* @throws IllegalArgumentException if the upper limit equals or less than 0 * @throws IllegalArgumentException if the upper limit equals or less than 0
* @since 1.0.0 * @since 1.0.0
* @author jifengnan * @author jifengnan