I18N effort for dubbo-common, translate the missing content
This commit is contained in:
parent
48661bc8e8
commit
dec42d2954
|
|
@ -116,7 +116,7 @@ public final class URL implements Serializable {
|
|||
this(protocol, null, null, host, port, null, (Map<String, String>) null);
|
||||
}
|
||||
|
||||
public URL(String protocol, String host, int port, String[] pairs) { // 变长参数...与下面的path参数冲突,改为数组
|
||||
public URL(String protocol, String host, int port, String[] pairs) { // varargs ... confilict with the following path argument, use array instead.
|
||||
this(protocol, null, null, host, port, null, CollectionUtils.toStringMap(pairs));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ public final class JavaBeanSerializeUtil {
|
|||
}
|
||||
|
||||
/**
|
||||
* 把 Class.forName 的返回值转换为 Class.
|
||||
* Transform the Class.forName String to Class Object.
|
||||
*
|
||||
* @param name Class.getName()
|
||||
* @return Class
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class MemoryStatusChecker implements StatusChecker {
|
|||
long freeMemory = runtime.freeMemory();
|
||||
long totalMemory = runtime.totalMemory();
|
||||
long maxMemory = runtime.maxMemory();
|
||||
boolean ok = (maxMemory - (totalMemory - freeMemory) > 2048); // 剩余空间小于2M报警
|
||||
boolean ok = (maxMemory - (totalMemory - freeMemory) > 2048); // Alarm when spare memory < 2M
|
||||
String msg = "max:" + (maxMemory / 1024 / 1024) + "M,total:"
|
||||
+ (totalMemory / 1024 / 1024) + "M,used:" + ((totalMemory / 1024 / 1024) - (freeMemory / 1024 / 1024)) + "M,free:" + (freeMemory / 1024 / 1024) + "M";
|
||||
return new Status(ok ? Status.Level.OK : Status.Level.WARN, msg);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ public class AbortPolicyWithReport extends ThreadPoolExecutor.AbortPolicy {
|
|||
private void dumpJStack() {
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
//十分钟打一次
|
||||
//dump every 10 minutes
|
||||
if (now - lastPrintTime < 10 * 60 * 1000) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -252,12 +252,12 @@ public final class ReflectUtils {
|
|||
try {
|
||||
ParameterizedType parameterizedType = ((ParameterizedType) cls.getGenericInterfaces()[0]);
|
||||
Object genericClass = parameterizedType.getActualTypeArguments()[i];
|
||||
if (genericClass instanceof ParameterizedType) { // 处理多级泛型
|
||||
if (genericClass instanceof ParameterizedType) { // handle nested generic type
|
||||
return (Class<?>) ((ParameterizedType) genericClass).getRawType();
|
||||
} else if (genericClass instanceof GenericArrayType) { // 处理数组泛型
|
||||
} else if (genericClass instanceof GenericArrayType) { // handle array generic type
|
||||
return (Class<?>) ((GenericArrayType) genericClass).getGenericComponentType();
|
||||
} else if (((Class) genericClass).isArray()) {
|
||||
// 在 JDK 7 以上的版本, Foo<int[]> 不再是 GenericArrayType
|
||||
// Requires JDK 7 or higher, Foo<int[]> is no longer GenericArrayType
|
||||
return ((Class) genericClass).getComponentType();
|
||||
} else {
|
||||
return (Class<?>) genericClass;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
package com.alibaba.dubbo.common;
|
||||
|
||||
import com.alibaba.dubbo.common.utils.CollectionUtils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -243,7 +244,7 @@ public class URLTest {
|
|||
assertEquals("noValue", url.getParameter("noValue"));
|
||||
}
|
||||
|
||||
// TODO 不希望空格? 详见: DUBBO-502 URL类对特殊字符处理统一约定
|
||||
// TODO Do not want to use spaces? See: DUBBO-502, URL class handles special conventions for special characters.
|
||||
@Test
|
||||
public void test_valueOf_spaceSafe() throws Exception {
|
||||
URL url = URL.valueOf("http://1.2.3.4:8080/path?key=value1 value2");
|
||||
|
|
@ -257,7 +258,7 @@ public class URLTest {
|
|||
|
||||
assertTrue(url.hasParameter("k0"));
|
||||
|
||||
// 没有Value的Key,生成的Value值使用Key值!! -_-!!!
|
||||
// If a Key has no corresponding Value, then the Key also used as the Value.
|
||||
assertEquals("k0", url.getParameter("k0"));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,13 +25,13 @@ import com.alibaba.dubbo.common.extension.SPI;
|
|||
*/
|
||||
@SPI("impl1")
|
||||
public interface SimpleExt {
|
||||
// 没有使用key的@Adaptive !
|
||||
// @Adaptive example, do not specify a explicit key.
|
||||
@Adaptive
|
||||
String echo(URL url, String s);
|
||||
|
||||
@Adaptive({"key1", "key2"})
|
||||
String yell(URL url, String s);
|
||||
|
||||
// 无@Adaptive !
|
||||
// no @Adaptive
|
||||
String bang(URL url, int i);
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ import com.alibaba.dubbo.common.extension.SPI;
|
|||
*/
|
||||
@SPI
|
||||
public interface Ext2 {
|
||||
// 方法参数的属性是URL!
|
||||
// one of the properties of an argument is an instance of URL.
|
||||
@Adaptive
|
||||
String echo(UrlHolder holder, String s);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ public class ConfigUtilsTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* 测试点1:用户配置-default,会删除所有默认参数
|
||||
* Test Point 1: The user configures -default, which will delete all the default parameters
|
||||
*/
|
||||
@Test
|
||||
public void testMergeValuesDelete() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue