diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Extension.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Extension.java index fce54a6c7405917e049ea7fd04e2de0e96127cd1..1cd2031ed0d4cd05fdb919dae145782a77cb254d 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Extension.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Extension.java @@ -1,18 +1,20 @@ /* - * 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. * See the License for the specific language governing permissions and * limitations under the License. */ + package com.alibaba.dubbo.common; import java.lang.annotation.Documented; @@ -22,32 +24,34 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * 扩展点接口的标识。 + * Marker for extension interface *

- * 扩展点声明配置文件,格式修改。
- * 以Protocol示例,配置文件META-INF/dubbo/com.xxx.Protocol内容:
- * 由
- *

com.foo.XxxProtocol
- * com.foo.YyyProtocol

- * 改成使用KV格式
- *
xxx=com.foo.XxxProtocol
- * yyy=com.foo.YyyProtocol
- * 
+ * Changes on extension configuration file
+ * Use Protocol as an example, its configuration file 'META-INF/dubbo/com.xxx.Protocol' is changes from:
+ *
+ *     com.foo.XxxProtocol
+ *     com.foo.YyyProtocol
+ * 
+ *

+ * to key-value pair
+ *

+ *     xxx=com.foo.XxxProtocol
+ *     yyy=com.foo.YyyProtocol
+ * 
*
- * 原因:
- * 当扩展点的static字段或方法签名上引用了三方库, - * 如果三方库不存在,会导致类初始化失败, - * Extension标识Dubbo就拿不到了,异常信息就和配置对应不起来。 - *
- * 比如: - * Extension("mina")加载失败, - * 当用户配置使用mina时,就会报找不到扩展点, - * 而不是报加载扩展点失败,以及失败原因。 + * The reason for this change is: + *

+ * If there's third party library referenced by static field or by method in extension implementation, its class will + * fail to initialize if the third party library doesn't exist. In this case, dubbo cannot figure out extension's id + * therefore cannot be able to map the exception information with the extension, if the previous format is used. + *

+ * For example: + *

+ * Fails to load Extension("mina"). When user configure to use mina, dubbo will complain the extension cannot be loaded, + * instead of reporting which extract extension implementation fails and the extract reason. + *

* - * @author william.liangf - * @author ding.lid - * @export - * @deprecated 因为含义广泛废弃,改用功 {@link com.alibaba.dubbo.common.extension.SPI} + * @deprecated because it's too general, switch to use {@link com.alibaba.dubbo.common.extension.SPI} */ @Deprecated @Documented diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Node.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Node.java index 019dbea97ad1dd4afb2a88c9409bf5947e1ac01f..c3cfef29497ab00e243a1950b7bbdac5aa0246b0 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Node.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Node.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,8 +18,6 @@ package com.alibaba.dubbo.common; /** * Node. (API/SPI, Prototype, ThreadSafe) - * - * @author william.liangf */ public interface Node { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Parameters.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Parameters.java index 9aa506777ea2e1364cd063e735bbe3e29e73cc73..ec231304de890d7a1c405f5b988aa07402012bf4 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Parameters.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Parameters.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,9 +28,8 @@ import java.util.HashMap; import java.util.Map; /** - * 兼容2.0.5之前版本 + * Parameters for backward compatibility for version prior to 2.0.5 * - * @author tony.chenl * @deprecated */ @Deprecated diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Resetable.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Resetable.java index e7a533917441b3d1585ee6a8dac0282d04d8ae5a..81294e41ebf3d53f3c96f92783f8a7329449c1b0 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Resetable.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Resetable.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,8 +18,6 @@ package com.alibaba.dubbo.common; /** * Resetable. - * - * @author william.liangf */ public interface Resetable { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java index d89f5735d58ebb6a5fb5bf48c622f3720078ad01..2f40c73309bb183beda6adb1103a5b384e512177 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.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. @@ -64,8 +65,6 @@ import java.util.concurrent.ConcurrentHashMap; * for this case, url protocol = null, url host = home, url path = user1/router.js * * - * @author william.liangf - * @author ding.lid * @see java.net.URL * @see java.net.URI */ @@ -306,15 +305,12 @@ public final class URL implements Serializable { } /** - * 获取IP地址. - *

- * 请注意: - * 如果和Socket的地址对比, - * 或用地址作为Map的Key查找, - * 请使用IP而不是Host, - * 否则配置域名会有问题 + * Fetch IP address for this URL. + * + * Pls. note that IP should be used instead of Host when to compare with socket's address or to search in a map + * which use address as its key. * - * @return ip + * @return ip in string format */ public String getIp() { if (ip == null) { @@ -445,14 +441,14 @@ public final class URL implements Serializable { } private Map getNumbers() { - if (numbers == null) { // 允许并发重复创建 + if (numbers == null) { // concurrent initialization is tolerant numbers = new ConcurrentHashMap(); } return numbers; } private Map getUrls() { - if (urls == null) { // 允许并发重复创建 + if (urls == null) { // concurrent initialization is tolerant urls = new ConcurrentHashMap(); } return urls; @@ -929,7 +925,7 @@ public final class URL implements Serializable { || value == null || value.length() == 0) { return this; } - // 如果没有修改,直接返回。 + // if value doesn't change, return immediately if (value.equals(getParameters().get(key))) { // value != null return this; } @@ -955,7 +951,7 @@ public final class URL implements Serializable { /** * Add parameters to a new url. * - * @param parameters + * @param parameters parameters in key-value pairs * @return A new URL */ public URL addParameters(Map parameters) { @@ -978,7 +974,7 @@ public final class URL implements Serializable { } } } - // 如果没有修改,直接返回。 + // return immediately if there's no change if (hasAndEqual) return this; Map map = new HashMap(getParameters()); diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Version.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Version.java index 928bea367da59a97a5e863e3414ef3e1fbe294b7..90f6f4a1bc7495b475db0fa190cc2703606baffc 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Version.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Version.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,8 +28,6 @@ import java.util.Set; /** * Version - * - * @author william.liangf */ public final class Version { @@ -38,7 +37,7 @@ public final class Version { private static final boolean COMPATIBLE = hasResource("com/taobao/remoting/impl/ConnectionRequest.class"); static { - // 检查是否存在重复的jar包 + // check if there's duplicated jar Version.checkDuplicate(Version.class); } @@ -67,13 +66,13 @@ public final class Version { public static String getVersion(Class cls, String defaultVersion) { try { - // 首先查找MANIFEST.MF规范中的版本号 + // find version info from MANIFEST.MF first String version = cls.getPackage().getImplementationVersion(); if (version == null || version.length() == 0) { version = cls.getPackage().getSpecificationVersion(); } if (version == null || version.length() == 0) { - // 如果规范中没有版本号,基于jar包名获取版本号 + // guess version fro jar file name if nothing's found from MANIFEST.MF CodeSource codeSource = cls.getProtectionDomain().getCodeSource(); if (codeSource == null) { logger.info("No codeSource for class " + cls.getName() + " when getVersion, use default version " + defaultVersion); @@ -101,10 +100,10 @@ public final class Version { } } } - // 返回版本号,如果为空返回缺省版本号 + // return default version if no version info is found return version == null || version.length() == 0 ? defaultVersion : version; - } catch (Throwable e) { // 防御性容错 - // 忽略异常,返回缺省版本号 + } catch (Throwable e) { + // return default version when any exception is thrown logger.error("return default version, ignore exception " + e.getMessage(), e); return defaultVersion; } @@ -120,7 +119,7 @@ public final class Version { public static void checkDuplicate(String path, boolean failOnError) { try { - // 在ClassPath搜文件 + // search in caller's classloader Enumeration urls = ClassHelper.getCallerClassLoader(Version.class).getResources(path); Set files = new HashSet(); while (urls.hasMoreElements()) { @@ -132,7 +131,7 @@ public final class Version { } } } - // 如果有多个,就表示重复 + // duplicated jar is found if (files.size() > 1) { String error = "Duplicate class " + path + " in " + files.size() + " jar " + files; if (failOnError) { @@ -141,7 +140,7 @@ public final class Version { logger.error(error); } } - } catch (Throwable e) { // 防御性容错 + } catch (Throwable e) { logger.error(e.getMessage(), e); } } diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanAccessor.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanAccessor.java index 2e5ae1fd2703530c83ad4bfde22b3aa196018135..563e8036d516d8c68e2fc196623d2f45f6e95206 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanAccessor.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanAccessor.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, @@ -15,9 +16,6 @@ */ package com.alibaba.dubbo.common.beanutil; -/** - * @author kimi - */ public enum JavaBeanAccessor { /** diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java index b4530e306f9a6b6f3b3ac3c7a6c85f4b536b5950..1550f96bbcce43ffbd9ec660a3ad8505bca34936 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanDescriptor.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, @@ -21,9 +22,6 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -/** - * @author kimi - */ public final class JavaBeanDescriptor implements Serializable, Iterable> { public static final int TYPE_CLASS = 1; diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanSerializeUtil.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanSerializeUtil.java index 074c610c027c79b69ac027bb60e861d191e044ea..284a1e2ef5f29a1ad4bf6758380b3dcd4d68c37d 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanSerializeUtil.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/beanutil/JavaBeanSerializeUtil.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, @@ -30,9 +31,6 @@ import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Map; -/** - * @author kimi - */ public final class JavaBeanSerializeUtil { private static final Logger logger = LoggerFactory.getLogger(JavaBeanSerializeUtil.class); diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/ClassGenerator.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/ClassGenerator.java index 913e3a396ebf9fe401662e74a7e55967536fb325..fdca66257531198be7216a6c73207081e7b6611e 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/ClassGenerator.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/ClassGenerator.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. @@ -44,10 +45,7 @@ import java.util.concurrent.atomic.AtomicLong; /** * ClassGenerator - * - * @author qian.lei */ - public final class ClassGenerator { private static final AtomicLong CLASS_NAME_COUNTER = new AtomicLong(0); private static final String SIMPLE_NAME_TAG = ""; diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Mixin.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Mixin.java index 36bfb27179023fc538b2c17ff83983be302dff9d..4a9eb61e6956e68cf6b0cf06ce33f4efd9f07461 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Mixin.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Mixin.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. @@ -26,10 +27,7 @@ import java.util.concurrent.atomic.AtomicLong; /** * Mixin - * - * @author qian.lei */ - public abstract class Mixin { private static final String PACKAGE_NAME = Mixin.class.getPackage().getName(); private static AtomicLong MIXIN_CLASS_COUNTER = new AtomicLong(0); diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchMethodException.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchMethodException.java index 40a8bf57b6b0f4d4bf0de17310ab8e04f52f8bce..b5f188cf362cf6d50331f636c77237b77eb7ccfe 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchMethodException.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchMethodException.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,8 +18,6 @@ package com.alibaba.dubbo.common.bytecode; /** * NoSuchMethodException. - * - * @author qian.lei */ public class NoSuchMethodException extends RuntimeException { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchPropertyException.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchPropertyException.java index 28d53a0800d8faa6b8e2fe6d46b75b70119d2a38..564deab57c49e011a49617b8b91134281af11e88 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchPropertyException.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/NoSuchPropertyException.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,8 +18,6 @@ package com.alibaba.dubbo.common.bytecode; /** * NoSuchPropertyException. - * - * @author qian.lei */ public class NoSuchPropertyException extends RuntimeException { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Proxy.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Proxy.java index c7b1e4658b6fdc84fe3d04b7a32db62b4fd6c167..f6761f715f040b63e26e4e24a3c0fe98e1c024cb 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Proxy.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Proxy.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,8 +35,6 @@ import java.util.concurrent.atomic.AtomicLong; /** * Proxy. - * - * @author qian.lei */ public abstract class Proxy { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Wrapper.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Wrapper.java index f69eb8be58ae433b43777e8add41534ca898d90a..25ddddb4128529fc9fd756db07ab50e24a5a5943 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Wrapper.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/bytecode/Wrapper.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. @@ -33,10 +34,7 @@ import java.util.regex.Matcher; /** * Wrapper. - * - * @author qian.lei */ - public abstract class Wrapper { private static final Map, Wrapper> WRAPPER_MAP = new ConcurrentHashMap, Wrapper>(); //class wrapper map private static final String[] EMPTY_STRING_ARRAY = new String[0]; diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/Compiler.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/Compiler.java index 82ec8a8e6f381eece17b5485cc3591d63273d865..65a719689b5763e5912b6d48ddd2bd85848b0e11 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/Compiler.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/Compiler.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 @@ import com.alibaba.dubbo.common.extension.SPI; /** * Compiler. (SPI, Singleton, ThreadSafe) - * - * @author william.liangf */ @SPI("javassist") public interface Compiler { @@ -30,7 +29,7 @@ public interface Compiler { * Compile java source code. * * @param code Java source code - * @param classLoader TODO + * @param classLoader classloader * @return Compiled class */ Class compile(String code, ClassLoader classLoader); diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AbstractCompiler.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AbstractCompiler.java index 6652666599168d82e57774773f3bdadb26b4ef46..b007244624c2484d8d4ea72e31ba86a1afcdda3c 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AbstractCompiler.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AbstractCompiler.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 @@ import java.util.regex.Pattern; /** * Abstract compiler. (SPI, Prototype, ThreadSafe) - * - * @author william.liangf */ public abstract class AbstractCompiler implements Compiler { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AdaptiveCompiler.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AdaptiveCompiler.java index 2173b65f05e2ed91da092ba68e8e8359e7b2df4a..a088256789bf9b36a465476ad5c3981a078b86d9 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AdaptiveCompiler.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/AdaptiveCompiler.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,8 +23,6 @@ import com.alibaba.dubbo.common.extension.ExtensionLoader; /** * AdaptiveCompiler. (SPI, Singleton, ThreadSafe) - * - * @author william.liangf */ @Adaptive public class AdaptiveCompiler implements Compiler { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/ClassUtils.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/ClassUtils.java index 1122b6afd43852f4aec9b30c20ccadafed154ab7..a7d574696e8d6f1b2541d85079fcfcf657adf852 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/ClassUtils.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/ClassUtils.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. @@ -30,8 +31,6 @@ import java.util.Map; /** * ClassUtils. (Tool, Static, ThreadSafe) - * - * @author william.liangf */ public class ClassUtils { @@ -113,11 +112,12 @@ public class ClassUtils { try { return arrayForName(className); } catch (ClassNotFoundException e) { - if (className.indexOf('.') == -1) { // 尝试java.lang包 + // try to load from java.lang package + if (className.indexOf('.') == -1) { try { return arrayForName("java.lang." + className); } catch (ClassNotFoundException e2) { - // 忽略尝试异常, 抛出原始异常 + // ignore, let the original exception be thrown } } throw e; @@ -259,9 +259,9 @@ public class ClassUtils { try { ParameterizedType parameterizedType = ((ParameterizedType) cls.getGenericInterfaces()[0]); Object genericClass = parameterizedType.getActualTypeArguments()[i]; - if (genericClass instanceof ParameterizedType) { // 处理多级泛型 + if (genericClass instanceof ParameterizedType) { return (Class) ((ParameterizedType) genericClass).getRawType(); - } else if (genericClass instanceof GenericArrayType) { // 处理数组泛型 + } else if (genericClass instanceof GenericArrayType) { return (Class) ((GenericArrayType) genericClass).getGenericComponentType(); } else if (genericClass != null) { return (Class) genericClass; diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JavassistCompiler.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JavassistCompiler.java index a0c000f17288b114e067550aaaa02ed696eba063..25d95be497a1d5cbfb5a8678e5e5206a6cd6b1a3 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JavassistCompiler.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JavassistCompiler.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. @@ -33,8 +34,6 @@ import java.util.regex.Pattern; /** * JavassistCompiler. (SPI, Singleton, ThreadSafe) - * - * @author william.liangf */ public class JavassistCompiler extends AbstractCompiler { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JdkCompiler.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JdkCompiler.java index 9cda23c2897a3985dbc8e80d123f065082dcc7cf..c38565ec2624bcd03da14e8c8200af06b64cd388 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JdkCompiler.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/compiler/support/JdkCompiler.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. @@ -51,8 +52,6 @@ import java.util.Set; /** * JdkCompiler. (SPI, Singleton, ThreadSafe) - * - * @author william.liangf */ public class JdkCompiler extends AbstractCompiler { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ExecutionList.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ExecutionList.java index 5a1448581dda45f38e3cfabe450187821a11bab7..ee88167594c655f5f534b8a877b22e2bfc79a518 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ExecutionList.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ExecutionList.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.common.concurrent; import com.alibaba.dubbo.common.logger.Logger; @@ -22,10 +38,6 @@ import java.util.concurrent.TimeUnit; * RejectedExecutionException} or an exception thrown by {@linkplain * MoreExecutors#sameThreadExecutor inline execution}) will be caught and * logged. - * - * @author Nishant Thakkar - * @author Sven Mawson - * @since 1.0 */ public final class ExecutionList { // Logger to log exceptions caught when running runnables. diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFuture.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFuture.java index 1600b3007985b6c13cceb3632a7a4fcf9300a524..c79454e79cea3c42f53bb1950fd5cb3d9876d945 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFuture.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFuture.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.common.concurrent; import java.util.concurrent.Executor; @@ -62,10 +78,6 @@ import java.util.concurrent.RejectedExecutionException; * impossible to change the return type. For this case, we provide a more * expensive workaround in {@code JdkFutureAdapters}. However, when possible, it * is more efficient and reliable to create a {@code ListenableFuture} directly. - * - * @author Sven Mawson - * @author Nishant Thakkar - * @since 1.0 */ public interface ListenableFuture extends Future { /** diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFutureTask.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFutureTask.java index 538d05c983e95e4aa35e8e1834896b1b55ff3e56..d0459bdada8a5ee86ecd46ac0e3f861dbb34323c 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFutureTask.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/concurrent/ListenableFutureTask.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.common.concurrent; import java.util.concurrent.Callable; @@ -9,11 +25,6 @@ import java.util.concurrent.FutureTask; * interface. Unlike {@code FutureTask}, {@code ListenableFutureTask} does not * provide an overrideable {@link FutureTask#done() done()} method. For similar * functionality, call {@link #addListener}. - *

- *

- * - * @author Sven Mawson - * @since 1.0 */ public class ListenableFutureTask extends FutureTask implements ListenableFuture { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java index fa00f548100d7b63c3b5fc996307c62a3a31b642..7db8fe10a2527ee5e2c886c27e05dee6b940acef 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.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,6 +16,8 @@ */ package com.alibaba.dubbo.common.extension; +import com.alibaba.dubbo.common.URL; + import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -22,62 +25,64 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * Activate - *

- * 对于可以被框架中自动激活加载扩展,此Annotation用于配置扩展被自动激活加载条件。 - * 比如,过滤扩展,有多个实现,使用Activate Annotation的扩展可以根据条件被自动加载。 + * Activate. This annotation is useful for automatically activate certain extensions with the given criteria, + * for examples: @Activate can be used to load certain Filter extension when there are + * multiple implementations. *

    - *
  1. {@link Activate#group()}生效的Group。具体的有哪些Group值由框架SPI给出。 - *
  2. {@link Activate#value()}在{@link com.alibaba.dubbo.common.URL}中Key集合中有,则生效。 + *
  3. {@link Activate#group()} specifies group criteria. Framework SPI defines the valid group values. + *
  4. {@link Activate#value()} specifies parameter key in {@link URL} criteria. *
- *

- *

- * 底层框架SPI提供者通过{@link com.alibaba.dubbo.common.extension.ExtensionLoader}的{@link ExtensionLoader#getActivateExtension}方法 - * 获得条件的扩展。 + * SPI provider can call {@link ExtensionLoader#getActivateExtension(URL, String, String)} to find out all activated + * extensions with the given criteria. * - * @author william.liangf - * @author ding.lid - * @export * @see SPI + * @see URL * @see ExtensionLoader - * @see ExtensionLoader#getActivateExtension(com.alibaba.dubbo.common.URL, String[], String) */ @Documented @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface Activate { /** - * Group过滤条件。 - *
- * 包含{@link ExtensionLoader#getActivateExtension}的group参数给的值,则返回扩展。 - *
- * 如没有Group设置,则不过滤。 + * Activate the current extension when one of the groups matches. The group passed into + * {@link ExtensionLoader#getActivateExtension(URL, String, String)} will be used for matching. + * + * @return group names to match + * @see ExtensionLoader#getActivateExtension(URL, String, String) */ String[] group() default {}; /** - * Key过滤条件。包含{@link ExtensionLoader#getActivateExtension}的URL的参数Key中有,则返回扩展。 - *

- * 示例:
- * 注解的值 @Activate("cache,validatioin"), - * 则{@link ExtensionLoader#getActivateExtension}的URL的参数有cacheKey,或是validatioin则返回扩展。 - *
- * 如没有设置,则不过滤。 + * Activate the current extension when the specified keys appear in the URL's parameters. + *

+ * For example, given @Activate("cache, validation"), the current extension will be return only when + * there's either cache or validation key appeared in the URL's parameters. + *

+ * + * @return URL parameter keys + * @see ExtensionLoader#getActivateExtension(URL, String) + * @see ExtensionLoader#getActivateExtension(URL, String, String) */ String[] value() default {}; /** - * 排序信息,可以不提供。 + * Relative ordering info, optional + * + * @return extension list which should be put before the current one */ String[] before() default {}; /** - * 排序信息,可以不提供。 + * Relative ordering info, optional + * + * @return extension list which should be put after the current one */ String[] after() default {}; /** - * 排序信息,可以不提供。 + * Absolute ordering info, optional + * + * @return absolute ordering info */ int order() default 0; } \ No newline at end of file diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Adaptive.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Adaptive.java index 5cc7f73ad503297a98cd619b99b67e02bc3a9792..d7cc208333d552b3e5266856cc79d7b1af5aef73 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Adaptive.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Adaptive.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,10 +25,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * 在{@link ExtensionLoader}生成Extension的Adaptive Instance时,为{@link ExtensionLoader}提供信息。 + * Provide helpful information for {@link ExtensionLoader} to inject dependency extension instance. * - * @author ding.lid - * @export * @see ExtensionLoader * @see URL */ @@ -35,23 +34,26 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.METHOD}) public @interface Adaptive { - /** - * 从{@link URL}的Key名,对应的Value作为要Adapt成的Extension名。 + * Decide which target extension to be injected. The name of the target extension is decided by the parameter passed + * in the URL, and the parameter names are given by this method. *

- * 如果{@link URL}这些Key都没有Value,使用 用 缺省的扩展(在接口的{@link SPI}中设定的值)。
- * 比如,String[] {"key1", "key2"},表示 + * If the specified parameters are not found from {@link URL}, then the default extension will be used for + * dependency injection (specified in its interface's {@link SPI}). + *

+ * For examples, given String[] {"key1", "key2"}: *

    - *
  1. 先在URL上找key1的Value作为要Adapt成的Extension名; - *
  2. key1没有Value,则使用key2的Value作为要Adapt成的Extension名。 - *
  3. key2没有Value,使用缺省的扩展。 - *
  4. 如果没有设定缺省扩展,则方法调用会抛出{@link IllegalStateException}。 + *
  5. find parameter 'key1' in URL, use its value as the extension's name
  6. + *
  7. try 'key2' for extension's name if 'key1' is not found (or its value is empty) in URL
  8. + *
  9. use default extension if 'key2' doesn't appear either
  10. + *
  11. otherwise, throw {@link IllegalStateException}
  12. *
- *

- * 如果不设置则缺省使用Extension接口类名的点分隔小写字串。
- * 即对于Extension接口{@code com.alibaba.dubbo.xxx.YyyInvokerWrapper}的缺省值为String[] {"yyy.invoker.wrapper"} + * If default extension's name is not give on interface's {@link SPI}, then a name is generated from interface's + * class name with the rule: divide classname from capital char into several parts, and separate the parts with + * dot '.', for example: for {@code com.alibaba.dubbo.xxx.YyyInvokerWrapper}, its default name is + * String[] {"yyy.invoker.wrapper"}. This name will be used to search for parameter from URL. * - * @see SPI#value() + * @return parameter key names in URL */ String[] value() default {}; diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionFactory.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionFactory.java index c77238f20873463cd6fd5a06f33b559a89d0c604..4cfc7a7d7d0bcf1d66cea12b649dde17584b0e35 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionFactory.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionFactory.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,9 +18,6 @@ package com.alibaba.dubbo.common.extension; /** * ExtensionFactory - * - * @author william.liangf - * @export */ @SPI public interface ExtensionFactory { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java index a0c423149387de62cd75b00eed9317b4d6a8039f..50d70233c00cbb1f040046fde1e90f28b0ed6a32 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/ExtensionLoader.java @@ -43,16 +43,14 @@ import java.util.concurrent.ConcurrentMap; import java.util.regex.Pattern; /** - * Dubbo使用的扩展点获取。

+ * Load dubbo extensions *

* - * @author william.liangf - * @author ding.lid - * @see JDK5.0的自动发现机制实现 + * @see Service Provider in Java 5 * @see com.alibaba.dubbo.common.extension.SPI * @see com.alibaba.dubbo.common.extension.Adaptive * @see com.alibaba.dubbo.common.extension.Activate @@ -136,9 +134,7 @@ public class ExtensionLoader { } /** - * This is equivalent to
-     *     getActivateExtension(url, key, null);
-     * 
+ * This is equivalent to {@code getActivateExtension(url, key, null)} * * @param url url * @param key url parameter key which used to get extension point names @@ -150,9 +146,7 @@ public class ExtensionLoader { } /** - * This is equivalent to
-     *     getActivateExtension(url, values, null);
-     * 
+ * This is equivalent to {@code getActivateExtension(url, values, null)} * * @param url url * @param values extension point names @@ -164,9 +158,7 @@ public class ExtensionLoader { } /** - * This is equivalent to
-     *     getActivateExtension(url, url.getParameter(key).split(","), null);
-     * 
+ * This is equivalent to {@code getActivateExtension(url, url.getParameter(key).split(","), null)} * * @param url url * @param key url parameter key which used to get extension point names @@ -262,9 +254,10 @@ public class ExtensionLoader { } /** - * 返回扩展点实例,如果没有指定的扩展点或是还没加载(即实例化)则返回null。注意:此方法不会触发扩展点的加载。 - *

- * 一般应该调用{@link #getExtension(String)}方法获得扩展,这个方法会触发扩展点加载。 + * Get extension's instance. Return null if extension is not found or is not initialized. Pls. note + * that this method will not trigger extension load. + *

+ * In order to trigger extension load, call {@link #getExtension(String)} instead. * * @see #getExtension(String) */ @@ -281,9 +274,9 @@ public class ExtensionLoader { } /** - * 返回已经加载的扩展点的名字。 - *

- * 一般应该调用{@link #getSupportedExtensions()}方法获得扩展,这个方法会返回所有的扩展点。 + * Return the list of extensions which are already loaded. + *

+ * Usually {@link #getSupportedExtensions()} should be called in order to get all extensions. * * @see #getSupportedExtensions() */ @@ -292,10 +285,8 @@ public class ExtensionLoader { } /** - * 返回指定名字的扩展。如果指定名字的扩展不存在,则抛异常 {@link IllegalStateException}. - * - * @param name - * @return + * Find the extension with the given name. If the specified name is not found, then {@link IllegalStateException} + * will be thrown. */ @SuppressWarnings("unchecked") public T getExtension(String name) { @@ -323,7 +314,7 @@ public class ExtensionLoader { } /** - * 返回缺省的扩展,如果没有设置则返回null。 + * Return default extension, return null if it's not configured. */ public T getDefaultExtension() { getExtensionClasses(); @@ -350,7 +341,7 @@ public class ExtensionLoader { } /** - * 返回缺省的扩展点名,如果没有设置缺省则返回null。 + * Return default extension name, return null if not configured. */ public String getDefaultExtensionName() { getExtensionClasses(); @@ -358,11 +349,11 @@ public class ExtensionLoader { } /** - * 编程方式添加新扩展点。 + * Register new extension via API * - * @param name 扩展点名 - * @param clazz 扩展点类 - * @throws IllegalStateException 要添加扩展点名已经存在。 + * @param name extension name + * @param clazz extension class + * @throws IllegalStateException when extension with the same name has already been registered. */ public void addExtension(String name, Class clazz) { getExtensionClasses(); // load classes @@ -397,12 +388,12 @@ public class ExtensionLoader { } /** - * 编程方式添加替换已有扩展点。 + * Replace the existing extension via API * - * @param name 扩展点名 - * @param clazz 扩展点类 - * @throws IllegalStateException 要添加扩展点名已经存在。 - * @deprecated 不推荐应用使用,一般只在测试时可以使用 + * @param name extension name + * @param clazz extension class + * @throws IllegalStateException when extension to be placed doesn't exist + * @deprecated not recommended any longer, and use only when test */ @Deprecated public void replaceExtension(String name, Class clazz) { @@ -567,7 +558,7 @@ public class ExtensionLoader { return classes; } - // 此方法已经getExtensionClasses方法同步过。 + // synchronized in getExtensionClasses private Map> loadExtensionClasses() { final SPI defaultAnnotation = type.getAnnotation(SPI.class); if (defaultAnnotation != null) { @@ -744,7 +735,7 @@ public class ExtensionLoader { break; } } - // 完全没有Adaptive方法,则不需要生成Adaptive类 + // no need to generate adaptive class since there's no adaptive method found. if (!hasAdaptiveAnnotation) throw new IllegalStateException("No adaptive method on extension " + type.getName() + ", refuse to create the adaptive class!"); @@ -771,7 +762,7 @@ public class ExtensionLoader { break; } } - // 有类型为URL的参数 + // found parameter in URL type if (urlTypeIndex != -1) { // Null Point check String s = String.format("\nif (arg%d == null) throw new IllegalArgumentException(\"url == null\");", @@ -781,11 +772,11 @@ public class ExtensionLoader { s = String.format("\n%s url = arg%d;", URL.class.getName(), urlTypeIndex); code.append(s); } - // 参数没有URL类型 + // did not find parameter in URL type else { String attribMethod = null; - // 找到参数的URL属性 + // find URL getter method LBL_PTS: for (int i = 0; i < pts.length; ++i) { Method[] ms = pts[i].getMethods(); @@ -803,7 +794,7 @@ public class ExtensionLoader { } } if (attribMethod == null) { - throw new IllegalStateException("fail to create adative class for interface " + type.getName() + throw new IllegalStateException("fail to create adaptive class for interface " + type.getName() + ": not found url parameter or url attribute in parameters of method " + method.getName()); } @@ -820,7 +811,7 @@ public class ExtensionLoader { } String[] value = adaptiveAnnotation.value(); - // 没有设置Key,则使用“扩展点接口名的点分隔 作为Key + // value is not set, use the value generated from class name as the key if (value.length == 0) { char[] charArray = type.getSimpleName().toCharArray(); StringBuilder sb = new StringBuilder(128); diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/SPI.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/SPI.java index 044c0052533b282167173d6b9cdf8d8ae7201c93..7e7c5437ce6e6e6cff92c1be04532c4b6a6e087d 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/SPI.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/SPI.java @@ -1,18 +1,20 @@ /* - * 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. * See the License for the specific language governing permissions and * limitations under the License. */ + package com.alibaba.dubbo.common.extension; import java.lang.annotation.Documented; @@ -22,31 +24,32 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** - * 扩展点接口的标识。 + * Marker for extension interface *

- * 扩展点声明配置文件,格式修改。
- * 以Protocol示例,配置文件META-INF/dubbo/com.xxx.Protocol内容:
- * 由
- *

com.foo.XxxProtocol
- * com.foo.YyyProtocol

- * 改成使用KV格式
- *
xxx=com.foo.XxxProtocol
- * yyy=com.foo.YyyProtocol
- * 
+ * Changes on extension configuration file
+ * Use Protocol as an example, its configuration file 'META-INF/dubbo/com.xxx.Protocol' is changes from:
+ *
+ *     com.foo.XxxProtocol
+ *     com.foo.YyyProtocol
+ * 
+ *

+ * to key-value pair
+ *

+ *     xxx=com.foo.XxxProtocol
+ *     yyy=com.foo.YyyProtocol
+ * 
*
- * 原因:
- * 当扩展点的static字段或方法签名上引用了三方库, - * 如果三方库不存在,会导致类初始化失败, - * Extension标识Dubbo就拿不到了,异常信息就和配置对应不起来。 - *
- * 比如: - * Extension("mina")加载失败, - * 当用户配置使用mina时,就会报找不到扩展点, - * 而不是报加载扩展点失败,以及失败原因。 - * - * @author william.liangf - * @author ding.lid - * @export + * The reason for this change is: + *

+ * If there's third party library referenced by static field or by method in extension implementation, its class will + * fail to initialize if the third party library doesn't exist. In this case, dubbo cannot figure out extension's id + * therefore cannot be able to map the exception information with the extension, if the previous format is used. + *

+ * For example: + *

+ * Fails to load Extension("mina"). When user configure to use mina, dubbo will complain the extension cannot be loaded, + * instead of reporting which extract extension implementation fails and the extract reason. + *

*/ @Documented @Retention(RetentionPolicy.RUNTIME) @@ -54,7 +57,7 @@ import java.lang.annotation.Target; public @interface SPI { /** - * 缺省扩展点名。 + * default extension name */ String value() default ""; diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/AdaptiveExtensionFactory.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/AdaptiveExtensionFactory.java index 9c9457ba87446da3abe77ea41fcd4a55d598bcd0..c9235bdddd97564675e065e64f16329fc54da405 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/AdaptiveExtensionFactory.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/AdaptiveExtensionFactory.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,8 +26,6 @@ import java.util.List; /** * AdaptiveExtensionFactory - * - * @author william.liangf */ @Adaptive public class AdaptiveExtensionFactory implements ExtensionFactory { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/SpiExtensionFactory.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/SpiExtensionFactory.java index ce86189f7738d40ac712c9362c05c6e67dab358e..6c098de2d73f75ee4ad9e41fd212bbd5fcd6d8ee 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/SpiExtensionFactory.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/factory/SpiExtensionFactory.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. @@ -21,8 +22,6 @@ import com.alibaba.dubbo.common.extension.SPI; /** * SpiExtensionFactory - * - * @author william.liangf */ public class SpiExtensionFactory implements ExtensionFactory { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java index 8a2e09a87c6572c165c44848dba6197863ef72fa..809e883d894fd20e05bac67fdd939fd2b5ee7baf 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/support/ActivateComparator.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. @@ -23,8 +24,6 @@ import java.util.Comparator; /** * OrderComparetor - * - * @author william.liangf */ public class ActivateComparator implements Comparator { @@ -79,7 +78,8 @@ public class ActivateComparator implements Comparator { } int n1 = a1 == null ? 0 : a1.order(); int n2 = a2 == null ? 0 : a2.order(); - return n1 > n2 ? 1 : -1; // 就算n1 == n2也不能返回0,否则在HashSet等集合中,会被认为是同一值而覆盖 + // never return 0 even if n1 equals n2, otherwise, o1 and o2 will override each other in collection like HashSet + return n1 > n2 ? 1 : -1; } }