diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Cluster.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Cluster.java index 039c43bc52..f918e7af97 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Cluster.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Cluster.java @@ -28,6 +28,7 @@ import com.alibaba.dubbo.rpc.cluster.support.FailoverCluster; * Fault-Tolerant * * @author william.liangf + * @export */ @SPI(FailoverCluster.NAME) public interface Cluster { diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Configurator.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Configurator.java index 74357f0b2a..c892e19735 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Configurator.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Configurator.java @@ -21,6 +21,7 @@ import com.alibaba.dubbo.common.URL; * Configurator. (SPI, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface Configurator extends Comparable { diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/ConfiguratorFactory.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/ConfiguratorFactory.java index ae91854f1a..bbd6bd385b 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/ConfiguratorFactory.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/ConfiguratorFactory.java @@ -23,6 +23,7 @@ import com.alibaba.dubbo.common.extension.SPI; * ConfiguratorFactory. (SPI, Singleton, ThreadSafe) * * @author william.liangf + * @export */ @SPI public interface ConfiguratorFactory { diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Directory.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Directory.java index 1729b5ae9d..cfd56cf97b 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Directory.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Directory.java @@ -29,6 +29,7 @@ import com.alibaba.dubbo.rpc.RpcException; * * @see com.alibaba.dubbo.rpc.cluster.Cluster#join(Directory) * @author william.liangf + * @export */ public interface Directory extends Node { diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/LoadBalance.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/LoadBalance.java index d8290f508e..8e006049ff 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/LoadBalance.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/LoadBalance.java @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc.cluster; - +package com.alibaba.dubbo.rpc.cluster; + import java.util.List; import com.alibaba.dubbo.common.URL; @@ -24,28 +24,29 @@ import com.alibaba.dubbo.rpc.Invocation; import com.alibaba.dubbo.rpc.Invoker; import com.alibaba.dubbo.rpc.RpcException; import com.alibaba.dubbo.rpc.cluster.loadbalance.RandomLoadBalance; - -/** - * LoadBalance. (SPI, Singleton, ThreadSafe) - * - * Load-Balancing - * - * @see com.alibaba.dubbo.rpc.cluster.Cluster#join(Directory) - * @author qian.lei - * @author william.liangf - */ -@SPI(RandomLoadBalance.NAME) -public interface LoadBalance { - - /** - * select one invoker in list. - * + +/** + * LoadBalance. (SPI, Singleton, ThreadSafe) + * + * Load-Balancing + * + * @see com.alibaba.dubbo.rpc.cluster.Cluster#join(Directory) + * @author qian.lei + * @author william.liangf + * @export + */ +@SPI(RandomLoadBalance.NAME) +public interface LoadBalance { + + /** + * select one invoker in list. + * * @param invokers invokers. * @param url refer url - * @param invocation invocation. - * @return selected invoker. + * @param invocation invocation. + * @return selected invoker. */ - @Adaptive("loadbalance") - Invoker select(List> invokers, URL url, Invocation invocation) throws RpcException; - + @Adaptive("loadbalance") + Invoker select(List> invokers, URL url, Invocation invocation) throws RpcException; + } \ No newline at end of file diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Merger.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Merger.java index 2009f9e5c2..3c6e263a87 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Merger.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Merger.java @@ -19,6 +19,7 @@ import com.alibaba.dubbo.common.extension.SPI; /** * @author kimi + * @export */ @SPI public interface Merger { diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java index b5b5dc19fc..ad4e53f231 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/Router.java @@ -13,24 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc.cluster; - +package com.alibaba.dubbo.rpc.cluster; + import java.util.List; import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.rpc.Invocation; import com.alibaba.dubbo.rpc.Invoker; import com.alibaba.dubbo.rpc.RpcException; - -/** - * Router. (SPI, Prototype, ThreadSafe) + +/** + * Router. (SPI, Prototype, ThreadSafe) * * Routing * * @see com.alibaba.dubbo.rpc.cluster.Cluster#join(Directory) - * @see com.alibaba.dubbo.rpc.cluster.Directory#list(Invocation) - * @author chao.liuc - */ + * @see com.alibaba.dubbo.rpc.cluster.Directory#list(Invocation) + * @author chao.liuc + * @export + */ public interface Router extends Comparable { /** @@ -38,17 +39,17 @@ public interface Router extends Comparable { * * @return url */ - URL getUrl(); - - /** - * route. - * + URL getUrl(); + + /** + * route. + * * @param invokers * @param url refer url - * @param invocation - * @return routed invokers - * @throws RpcException - */ - List> route(List> invokers, URL url, Invocation invocation) throws RpcException; - + * @param invocation + * @return routed invokers + * @throws RpcException + */ + List> route(List> invokers, URL url, Invocation invocation) throws RpcException; + } \ No newline at end of file diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/RouterFactory.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/RouterFactory.java index b9b46b57a8..b077e77d58 100644 --- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/RouterFactory.java +++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/RouterFactory.java @@ -13,32 +13,33 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc.cluster; - +package com.alibaba.dubbo.rpc.cluster; + import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.extension.Adaptive; import com.alibaba.dubbo.common.extension.SPI; import com.alibaba.dubbo.rpc.Invocation; - -/** - * RouterFactory. (SPI, Singleton, ThreadSafe) + +/** + * RouterFactory. (SPI, Singleton, ThreadSafe) * * Routing * * @see com.alibaba.dubbo.rpc.cluster.Cluster#join(Directory) - * @see com.alibaba.dubbo.rpc.cluster.Directory#list(Invocation) - * @author chao.liuc + * @see com.alibaba.dubbo.rpc.cluster.Directory#list(Invocation) + * @author chao.liuc + * @export */ -@SPI -public interface RouterFactory { - - /** - * Create router. - * - * @param url - * @return router - */ - @Adaptive("protocol") - Router getRouter(URL url); - +@SPI +public interface RouterFactory { + + /** + * Create router. + * + * @param url + * @return router + */ + @Adaptive("protocol") + Router getRouter(URL url); + } \ No newline at end of file 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 9c9b2ef5b4..d0433d209f 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 @@ -38,6 +38,7 @@ import java.lang.annotation.Target; * @deprecated * @author william.liangf * @author ding.lid + * @export */ @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 888415874d..2ce948f088 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 @@ -21,6 +21,7 @@ import com.alibaba.dubbo.common.URL; * Node. (API/SPI, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface Node { 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 a70319679a..3887cf70f7 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 @@ -22,6 +22,7 @@ import com.alibaba.dubbo.common.extension.SPI; * Compiler. (SPI, Singleton, ThreadSafe) * * @author william.liangf + * @export */ @SPI("javassist") public interface Compiler { 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 40427fc17e..17b4243fd3 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 @@ -13,26 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.common.extension; - +package com.alibaba.dubbo.common.extension; + import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - + /** * Activate. - * - * @author william.liangf - */ -@Documented -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.METHOD}) -public @interface Activate { + * + * @author william.liangf + * @export + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.METHOD}) +public @interface Activate { String[] group() default {}; - + String[] value() default {}; String[] before() default {}; @@ -40,5 +41,5 @@ public @interface Activate { String[] after() default {}; 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 4a76ecd907..95b098e0d9 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,32 +1,33 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import com.alibaba.dubbo.common.URL; +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import com.alibaba.dubbo.common.URL; /** * 在{@link ExtensionLoader}生成Extension的Adaptive Instance时,为{@link ExtensionLoader}提供信息。 * * @author ding.lid + * @export * * @see ExtensionLoader * @see URL @@ -53,6 +54,6 @@ public @interface Adaptive { * * @see SPI#value() */ - String[] value() default {}; - + String[] value() default {}; + } \ No newline at end of file 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 73949b9163..26b3afde40 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 @@ -19,6 +19,7 @@ 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 37c9546f22..c82823a043 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 @@ -833,12 +833,7 @@ public class ExtensionLoader { } private static ClassLoader findClassLoader() { - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - if (classLoader != null) { - return classLoader; - } - classLoader = ExtensionLoader.class.getClassLoader(); - return classLoader; + return ExtensionLoader.class.getClassLoader(); } @Override 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 b9f45150fa..096fa0bd0a 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 @@ -26,6 +26,7 @@ import java.lang.annotation.Target; * * @author william.liangf * @author ding.lid + * @export */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataInput.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataInput.java index 68d6a2634a..b0dd2b5c41 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataInput.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataInput.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.serialize; import java.io.IOException; @@ -21,6 +21,7 @@ import java.io.IOException; * Data input. * * @author qian.lei + * @export */ public interface DataInput { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataOutput.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataOutput.java index 8e5970ef18..f8e439984f 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataOutput.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/DataOutput.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.serialize; import java.io.IOException; @@ -21,6 +21,7 @@ import java.io.IOException; * Data output. * * @author qian.lei + * @export */ public interface DataOutput { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectInput.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectInput.java index 67a4651227..42f9365002 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectInput.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectInput.java @@ -1,27 +1,28 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.serialize; -import java.io.IOException; -import java.lang.reflect.Type; +import java.io.IOException; +import java.lang.reflect.Type; /** * Object input. * * @author qian.lei + * @export */ public interface ObjectInput extends DataInput { @@ -38,14 +39,14 @@ public interface ObjectInput extends DataInput { * @param cls object type. * @return object. */ - T readObject(Class cls) throws IOException, ClassNotFoundException; - - /** - * read object. - * - * @param cls object type. - * @return object. - */ + T readObject(Class cls) throws IOException, ClassNotFoundException; + + /** + * read object. + * + * @param cls object type. + * @return object. + */ T readObject(Class cls, Type type) throws IOException, ClassNotFoundException; } \ No newline at end of file diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectOutput.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectOutput.java index c91d416aab..ac3317ae81 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectOutput.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/ObjectOutput.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.serialize; import java.io.IOException; @@ -21,6 +21,7 @@ import java.io.IOException; * Object output. * * @author qian.lei + * @export */ public interface ObjectOutput extends DataOutput { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/Serialization.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/Serialization.java index 8c8f1d04c4..23a2c9d6a8 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/Serialization.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/Serialization.java @@ -28,6 +28,7 @@ import com.alibaba.dubbo.common.extension.SPI; * * @author ding.lid * @author william.liangf + * @export */ @SPI("hessian2") public interface Serialization { diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/threadpool/ThreadPool.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/threadpool/ThreadPool.java index 57f50a2b63..0968bbd68c 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/threadpool/ThreadPool.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/threadpool/ThreadPool.java @@ -26,6 +26,7 @@ import com.alibaba.dubbo.common.extension.SPI; * ThreadPool * * @author william.liangf + * @export */ @SPI("fixed") public interface ThreadPool { 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 4d1ba7a803..7a5f0784bb 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 @@ -38,6 +38,7 @@ import com.alibaba.dubbo.config.support.Parameter; * AbstractConfig * * @author william.liangf + * @export */ public abstract class AbstractConfig implements Serializable { 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 5966bd3eeb..88c1e9f78b 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 @@ -44,6 +44,7 @@ import com.alibaba.dubbo.rpc.support.MockInvoker; * AbstractDefaultConfig * * @author william.liangf + * @export */ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig { 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 e9bc704120..1c838c64b1 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 @@ -25,6 +25,7 @@ import com.alibaba.dubbo.rpc.cluster.LoadBalance; * AbstractMethodConfig * * @author william.liangf + * @export */ public abstract class AbstractMethodConfig extends AbstractConfig { 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 6ac68d0718..1d8a8724f9 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 @@ -25,6 +25,7 @@ import com.alibaba.dubbo.rpc.InvokerListener; * * @see com.alibaba.dubbo.config.ReferenceConfig * @author william.liangf + * @export */ public abstract class AbstractReferenceConfig extends AbstractInterfaceConfig { 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 39cf8e7c6b..68f0ffe78b 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 @@ -26,6 +26,7 @@ import com.alibaba.dubbo.rpc.ExporterListener; * AbstractServiceConfig * * @author william.liangf + * @export */ public abstract class AbstractServiceConfig extends AbstractInterfaceConfig { 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 25d05e1fbd..1dd25ed3ac 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 @@ -28,6 +28,7 @@ import com.alibaba.dubbo.config.support.Parameter; * ApplicationConfig * * @author william.liangf + * @export */ public class ApplicationConfig extends AbstractConfig { 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 72ab60b0f3..295e2b9671 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,26 +1,27 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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; import java.io.Serializable; - -import com.alibaba.dubbo.config.support.Parameter; + +import com.alibaba.dubbo.config.support.Parameter; /** * @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 5de674c20f..d4430fa8c3 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 @@ -19,6 +19,7 @@ package com.alibaba.dubbo.config; * ConsumerConfig * * @author william.liangf + * @export */ public class ConsumerConfig extends AbstractReferenceConfig { 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 b1065e4e9d..c0c6218010 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 @@ -24,6 +24,7 @@ import com.alibaba.dubbo.config.support.Parameter; * MethodConfig * * @author william.liangf + * @export */ public class MethodConfig extends AbstractMethodConfig { 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 98d34e4fb1..0aaf98c74a 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 @@ -24,6 +24,7 @@ import com.alibaba.dubbo.config.support.Parameter; * ModuleConfig * * @author william.liangf + * @export */ public class ModuleConfig extends AbstractConfig { 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 8ddd32b03d..0e96d76a53 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 @@ -23,6 +23,7 @@ import com.alibaba.dubbo.config.support.Parameter; * MonitorConfig * * @author william.liangf + * @export */ public class MonitorConfig extends AbstractConfig { 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 8e2e744526..abbf7ad664 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 @@ -34,6 +34,7 @@ import com.alibaba.dubbo.rpc.Protocol; * ProtocolConfig * * @author william.liangf + * @export */ public class ProtocolConfig extends AbstractConfig { 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 de257d56fc..8251fda877 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 @@ -31,6 +31,7 @@ import com.alibaba.dubbo.remoting.telnet.TelnetHandler; * @see com.alibaba.dubbo.config.ProtocolConfig * @see com.alibaba.dubbo.config.ServiceConfig * @author william.liangf + * @export */ public class ProviderConfig extends AbstractServiceConfig { 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 f7667531b7..2d87f9381c 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 @@ -53,6 +53,7 @@ import com.alibaba.dubbo.rpc.service.GenericService; * ReferenceConfig * * @author william.liangf + * @export */ public class ReferenceConfig extends AbstractReferenceConfig { 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 225d4eac36..aa29830efc 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 @@ -27,6 +27,7 @@ import com.alibaba.dubbo.remoting.Transporter; * RegistryConfig * * @author william.liangf + * @export */ public class RegistryConfig extends AbstractConfig { 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 ef378c6037..89e36942a3 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 @@ -50,6 +50,7 @@ import com.alibaba.dubbo.rpc.service.GenericService; * ServiceConfig * * @author william.liangf + * @export */ public class ServiceConfig extends AbstractServiceConfig { 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 ec7ee9abb5..e1d8ffddd0 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 @@ -25,6 +25,7 @@ import java.lang.annotation.Target; * Reference * * @author william.liangf + * @export */ @Documented @Retention(RetentionPolicy.RUNTIME) 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 789ad37284..a8444fbb59 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 @@ -25,6 +25,7 @@ import java.lang.annotation.Target; * Service * * @author william.liangf + * @export */ @Documented @Retention(RetentionPolicy.RUNTIME) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java index e81f58f810..775fd39b91 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java @@ -55,6 +55,7 @@ import com.alibaba.dubbo.config.annotation.Service; * AnnotationBean * * @author william.liangf + * @export */ public class AnnotationBean extends AbstractConfig implements DisposableBean, BeanFactoryPostProcessor, BeanPostProcessor, ApplicationContextAware { diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java index a72f753309..d149448739 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ReferenceBean.java @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.config.spring; - +package com.alibaba.dubbo.config.spring; + import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -35,18 +35,19 @@ import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.config.annotation.Reference; import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; import com.alibaba.dubbo.config.support.Parameter; - -/** - * ReferenceFactoryBean - * - * @author william.liangf - */ -public class ReferenceBean extends ReferenceConfig implements FactoryBean, ApplicationContextAware, InitializingBean, DisposableBean { - - private static final long serialVersionUID = 213195494150089726L; - - private transient ApplicationContext applicationContext; - + +/** + * ReferenceFactoryBean + * + * @author william.liangf + * @export + */ +public class ReferenceBean extends ReferenceConfig implements FactoryBean, ApplicationContextAware, InitializingBean, DisposableBean { + + private static final long serialVersionUID = 213195494150089726L; + + private transient ApplicationContext applicationContext; + public ReferenceBean() { super(); } @@ -55,22 +56,22 @@ public class ReferenceBean extends ReferenceConfig implements FactoryBean, super(reference); } - public void setApplicationContext(ApplicationContext applicationContext) { + public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; - SpringExtensionFactory.addApplicationContext(applicationContext); - } - - public Object getObject() throws Exception { - return get(); - } + SpringExtensionFactory.addApplicationContext(applicationContext); + } + + public Object getObject() throws Exception { + return get(); + } - public Class getObjectType() { - return getInterfaceClass(); - } + public Class getObjectType() { + return getInterfaceClass(); + } - @Parameter(excluded = true) - public boolean isSingleton() { - return true; + @Parameter(excluded = true) + public boolean isSingleton() { + return true; } @SuppressWarnings({ "unchecked"}) @@ -170,6 +171,6 @@ public class ReferenceBean extends ReferenceConfig implements FactoryBean, if (b != null && b.booleanValue()) { getObject(); } - } - + } + } \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java index 490814298f..fbda3f4c99 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/ServiceBean.java @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.config.spring; - +package com.alibaba.dubbo.config.spring; + import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -40,23 +40,24 @@ import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.config.ServiceConfig; import com.alibaba.dubbo.config.annotation.Service; import com.alibaba.dubbo.config.spring.extension.SpringExtensionFactory; - -/** - * ServiceFactoryBean - * - * @author william.liangf - */ -public class ServiceBean extends ServiceConfig implements InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener, BeanNameAware { - - private static final long serialVersionUID = 213195494150089726L; - - private static transient ApplicationContext SPRING_CONTEXT; - - private transient ApplicationContext applicationContext; - - private transient String beanName; - - private transient boolean supportedApplicationListener; + +/** + * ServiceFactoryBean + * + * @author william.liangf + * @export + */ +public class ServiceBean extends ServiceConfig implements InitializingBean, DisposableBean, ApplicationContextAware, ApplicationListener, BeanNameAware { + + private static final long serialVersionUID = 213195494150089726L; + + private static transient ApplicationContext SPRING_CONTEXT; + + private transient ApplicationContext applicationContext; + + private transient String beanName; + + private transient boolean supportedApplicationListener; public ServiceBean() { super(); @@ -66,19 +67,19 @@ public class ServiceBean extends ServiceConfig implements InitializingBean super(service); } - public static ApplicationContext getSpringContext() { - return SPRING_CONTEXT; - } - - public void setApplicationContext(ApplicationContext applicationContext) { + public static ApplicationContext getSpringContext() { + return SPRING_CONTEXT; + } + + public void setApplicationContext(ApplicationContext applicationContext) { this.applicationContext = applicationContext; - SpringExtensionFactory.addApplicationContext(applicationContext); - if (applicationContext != null) { - SPRING_CONTEXT = applicationContext; - try { - Method method = applicationContext.getClass().getMethod("addApplicationListener", new Class[]{ApplicationListener.class}); // 兼容Spring2.0.1 + SpringExtensionFactory.addApplicationContext(applicationContext); + if (applicationContext != null) { + SPRING_CONTEXT = applicationContext; + try { + Method method = applicationContext.getClass().getMethod("addApplicationListener", new Class[]{ApplicationListener.class}); // 兼容Spring2.0.1 method.invoke(applicationContext, new Object[] {this}); - supportedApplicationListener = true; + supportedApplicationListener = true; } catch (Throwable t) { if (applicationContext instanceof AbstractApplicationContext) { try { @@ -90,39 +91,39 @@ public class ServiceBean extends ServiceConfig implements InitializingBean supportedApplicationListener = true; } catch (Throwable t2) { } - } - } - } - } - - public void setBeanName(String name) { - this.beanName = name; - } - - public void onApplicationEvent(ApplicationEvent event) { - if (ContextRefreshedEvent.class.getName().equals(event.getClass().getName())) { - if (isDelay()) { - if (logger.isInfoEnabled()) { - logger.info("The service ready on spring started. service: " + getInterface()); - } - export(); - } - } - } - - private boolean isDelay() { - Integer delay = getDelay(); - ProviderConfig provider = getProvider(); - if (delay == null && provider != null) { - delay = provider.getDelay(); - } - return supportedApplicationListener && (delay == null || delay.intValue() == -1); - } - - @SuppressWarnings({ "unchecked", "deprecation" }) - public void afterPropertiesSet() throws Exception { - if (getProvider() == null) { - Map providerConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ProviderConfig.class, false, false); + } + } + } + } + + public void setBeanName(String name) { + this.beanName = name; + } + + public void onApplicationEvent(ApplicationEvent event) { + if (ContextRefreshedEvent.class.getName().equals(event.getClass().getName())) { + if (isDelay()) { + if (logger.isInfoEnabled()) { + logger.info("The service ready on spring started. service: " + getInterface()); + } + export(); + } + } + } + + private boolean isDelay() { + Integer delay = getDelay(); + ProviderConfig provider = getProvider(); + if (delay == null && provider != null) { + delay = provider.getDelay(); + } + return supportedApplicationListener && (delay == null || delay.intValue() == -1); + } + + @SuppressWarnings({ "unchecked", "deprecation" }) + public void afterPropertiesSet() throws Exception { + if (getProvider() == null) { + Map providerConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ProviderConfig.class, false, false); if (providerConfigMap != null && providerConfigMap.size() > 0) { Map protocolConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ProtocolConfig.class, false, false); if ((protocolConfigMap == null || protocolConfigMap.size() == 0) @@ -149,13 +150,13 @@ public class ServiceBean extends ServiceConfig implements InitializingBean if (providerConfig != null) { setProvider(providerConfig); } - } - } - } - if (getApplication() == null - && (getProvider() == null || getProvider().getApplication() == null)) { - Map applicationConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ApplicationConfig.class, false, false); - if (applicationConfigMap != null && applicationConfigMap.size() > 0) { + } + } + } + if (getApplication() == null + && (getProvider() == null || getProvider().getApplication() == null)) { + Map applicationConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ApplicationConfig.class, false, false); + if (applicationConfigMap != null && applicationConfigMap.size() > 0) { ApplicationConfig applicationConfig = null; for (ApplicationConfig config : applicationConfigMap.values()) { if (config.isDefault() == null || config.isDefault().booleanValue()) { @@ -167,8 +168,8 @@ public class ServiceBean extends ServiceConfig implements InitializingBean } if (applicationConfig != null) { setApplication(applicationConfig); - } - } + } + } } if (getModule() == null && (getProvider() == null || getProvider().getModule() == null)) { @@ -187,28 +188,28 @@ public class ServiceBean extends ServiceConfig implements InitializingBean setModule(moduleConfig); } } - } - if ((getRegistries() == null || getRegistries().size() == 0) + } + if ((getRegistries() == null || getRegistries().size() == 0) && (getProvider() == null || getProvider().getRegistries() == null || getProvider().getRegistries().size() == 0) - && (getApplication() == null || getApplication().getRegistries() == null || getApplication().getRegistries().size() == 0)) { - Map registryConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, RegistryConfig.class, false, false); + && (getApplication() == null || getApplication().getRegistries() == null || getApplication().getRegistries().size() == 0)) { + Map registryConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, RegistryConfig.class, false, false); if (registryConfigMap != null && registryConfigMap.size() > 0) { List registryConfigs = new ArrayList(); for (RegistryConfig config : registryConfigMap.values()) { if (config.isDefault() == null || config.isDefault().booleanValue()) { registryConfigs.add(config); } - } - if (registryConfigs != null && registryConfigs.size() > 0) { - super.setRegistries(registryConfigs); - } - } - } - if (getMonitor() == null + } + if (registryConfigs != null && registryConfigs.size() > 0) { + super.setRegistries(registryConfigs); + } + } + } + if (getMonitor() == null && (getProvider() == null || getProvider().getMonitor() == null) - && (getApplication() == null || getApplication().getMonitor() == null)) { - Map monitorConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, MonitorConfig.class, false, false); - if (monitorConfigMap != null && monitorConfigMap.size() > 0) { + && (getApplication() == null || getApplication().getMonitor() == null)) { + Map monitorConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, MonitorConfig.class, false, false); + if (monitorConfigMap != null && monitorConfigMap.size() > 0) { MonitorConfig monitorConfig = null; for (MonitorConfig config : monitorConfigMap.values()) { if (config.isDefault() == null || config.isDefault().booleanValue()) { @@ -220,12 +221,12 @@ public class ServiceBean extends ServiceConfig implements InitializingBean } if (monitorConfig != null) { setMonitor(monitorConfig); - } - } - } - if ((getProtocols() == null || getProtocols().size() == 0) - && (getProvider() == null || getProvider().getProtocols() == null || getProvider().getProtocols().size() == 0)) { - Map protocolConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ProtocolConfig.class, false, false); + } + } + } + if ((getProtocols() == null || getProtocols().size() == 0) + && (getProvider() == null || getProvider().getProtocols() == null || getProvider().getProtocols().size() == 0)) { + Map protocolConfigMap = applicationContext == null ? null : BeanFactoryUtils.beansOfTypeIncludingAncestors(applicationContext, ProtocolConfig.class, false, false); if (protocolConfigMap != null && protocolConfigMap.size() > 0) { List protocolConfigs = new ArrayList(); for (ProtocolConfig config : protocolConfigMap.values()) { @@ -235,23 +236,23 @@ public class ServiceBean extends ServiceConfig implements InitializingBean } if (protocolConfigs != null && protocolConfigs.size() > 0) { super.setProtocols(protocolConfigs); - } - } - } - if (getPath() == null || getPath().length() == 0) { - if (beanName != null && beanName.length() > 0 - && getInterface() != null && getInterface().length() > 0 - && beanName.startsWith(getInterface())) { - setPath(beanName); - } + } + } + } + if (getPath() == null || getPath().length() == 0) { + if (beanName != null && beanName.length() > 0 + && getInterface() != null && getInterface().length() > 0 + && beanName.startsWith(getInterface())) { + setPath(beanName); + } } if (! isDelay()) { export(); - } + } } public void destroy() throws Exception { unexport(); - } - + } + } \ No newline at end of file diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java index e449da2afc..299dbee30d 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboBeanDefinitionParser.java @@ -1,62 +1,63 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.spring.schema; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; -import java.util.regex.Pattern; - -import org.springframework.beans.PropertyValue; -import org.springframework.beans.factory.config.BeanDefinition; -import org.springframework.beans.factory.config.BeanDefinitionHolder; -import org.springframework.beans.factory.config.RuntimeBeanReference; -import org.springframework.beans.factory.config.TypedStringValue; -import org.springframework.beans.factory.support.ManagedList; -import org.springframework.beans.factory.support.ManagedMap; -import org.springframework.beans.factory.support.RootBeanDefinition; -import org.springframework.beans.factory.xml.BeanDefinitionParser; -import org.springframework.beans.factory.xml.ParserContext; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.common.extension.ExtensionLoader; -import com.alibaba.dubbo.common.logger.Logger; -import com.alibaba.dubbo.common.logger.LoggerFactory; -import com.alibaba.dubbo.common.utils.ReflectUtils; -import com.alibaba.dubbo.common.utils.StringUtils; -import com.alibaba.dubbo.config.ArgumentConfig; -import com.alibaba.dubbo.config.MethodConfig; -import com.alibaba.dubbo.config.MonitorConfig; -import com.alibaba.dubbo.config.ProtocolConfig; -import com.alibaba.dubbo.config.ProviderConfig; -import com.alibaba.dubbo.config.RegistryConfig; -import com.alibaba.dubbo.config.spring.ReferenceBean; -import com.alibaba.dubbo.config.spring.ServiceBean; -import com.alibaba.dubbo.rpc.Protocol; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import java.util.regex.Pattern; + +import org.springframework.beans.PropertyValue; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.BeanDefinitionHolder; +import org.springframework.beans.factory.config.RuntimeBeanReference; +import org.springframework.beans.factory.config.TypedStringValue; +import org.springframework.beans.factory.support.ManagedList; +import org.springframework.beans.factory.support.ManagedMap; +import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.beans.factory.xml.BeanDefinitionParser; +import org.springframework.beans.factory.xml.ParserContext; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.extension.ExtensionLoader; +import com.alibaba.dubbo.common.logger.Logger; +import com.alibaba.dubbo.common.logger.LoggerFactory; +import com.alibaba.dubbo.common.utils.ReflectUtils; +import com.alibaba.dubbo.common.utils.StringUtils; +import com.alibaba.dubbo.config.ArgumentConfig; +import com.alibaba.dubbo.config.MethodConfig; +import com.alibaba.dubbo.config.MonitorConfig; +import com.alibaba.dubbo.config.ProtocolConfig; +import com.alibaba.dubbo.config.ProviderConfig; +import com.alibaba.dubbo.config.RegistryConfig; +import com.alibaba.dubbo.config.spring.ReferenceBean; +import com.alibaba.dubbo.config.spring.ServiceBean; +import com.alibaba.dubbo.rpc.Protocol; /** * AbstractBeanDefinitionParser * * @author william.liangf + * @export */ public class DubboBeanDefinitionParser implements BeanDefinitionParser { @@ -73,9 +74,9 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { public BeanDefinition parse(Element element, ParserContext parserContext) { return parse(element, parserContext, beanClass, required); - } - - @SuppressWarnings("unchecked") + } + + @SuppressWarnings("unchecked") private static BeanDefinition parse(Element element, ParserContext parserContext, Class beanClass, boolean required) { RootBeanDefinition beanDefinition = new RootBeanDefinition(); beanDefinition.setBeanClass(beanClass); @@ -83,12 +84,12 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { String id = element.getAttribute("id"); if ((id == null || id.length() == 0) && required) { String generatedBeanName = element.getAttribute("name"); - if (generatedBeanName == null || generatedBeanName.length() == 0) { - if (ProtocolConfig.class.equals(beanClass)) { - generatedBeanName = "dubbo"; + if (generatedBeanName == null || generatedBeanName.length() == 0) { + if (ProtocolConfig.class.equals(beanClass)) { + generatedBeanName = "dubbo"; } else { - generatedBeanName = element.getAttribute("interface"); - } + generatedBeanName = element.getAttribute("interface"); + } } if (generatedBeanName == null || generatedBeanName.length() == 0) { generatedBeanName = beanClass.getName(); @@ -103,7 +104,7 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { if (parserContext.getRegistry().containsBeanDefinition(id)) { throw new IllegalStateException("Duplicate spring bean id " + id); } - parserContext.getRegistry().registerBeanDefinition(id, beanDefinition); + parserContext.getRegistry().registerBeanDefinition(id, beanDefinition); beanDefinition.getPropertyValues().addPropertyValue("id", id); } if (ProtocolConfig.class.equals(beanClass)) { @@ -117,21 +118,21 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { } } } - } else if (ServiceBean.class.equals(beanClass)) { - String className = element.getAttribute("class"); - if(className != null && className.length() > 0) { - RootBeanDefinition classDefinition = new RootBeanDefinition(); - classDefinition.setBeanClass(ReflectUtils.forName(className)); - classDefinition.setLazyInit(false); - parseProperties(element.getChildNodes(), classDefinition); - beanDefinition.getPropertyValues().addPropertyValue("ref", new BeanDefinitionHolder(classDefinition, id + "Impl")); - } - } else if (ProviderConfig.class.equals(beanClass)) { - parseNested(element, parserContext, ServiceBean.class, true, "service", "provider", id, beanDefinition); - } else if (ProviderConfig.class.equals(beanClass)) { - parseNested(element, parserContext, ReferenceBean.class, false, "reference", "consumer", id, beanDefinition); - } - Set props = new HashSet(); + } else if (ServiceBean.class.equals(beanClass)) { + String className = element.getAttribute("class"); + if(className != null && className.length() > 0) { + RootBeanDefinition classDefinition = new RootBeanDefinition(); + classDefinition.setBeanClass(ReflectUtils.forName(className)); + classDefinition.setLazyInit(false); + parseProperties(element.getChildNodes(), classDefinition); + beanDefinition.getPropertyValues().addPropertyValue("ref", new BeanDefinitionHolder(classDefinition, id + "Impl")); + } + } else if (ProviderConfig.class.equals(beanClass)) { + parseNested(element, parserContext, ServiceBean.class, true, "service", "provider", id, beanDefinition); + } else if (ProviderConfig.class.equals(beanClass)) { + parseNested(element, parserContext, ReferenceBean.class, false, "reference", "consumer", id, beanDefinition); + } + Set props = new HashSet(); ManagedMap parameters = null; for (Method setter : beanClass.getMethods()) { String name = setter.getName(); @@ -139,7 +140,7 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { && Modifier.isPublic(setter.getModifiers()) && setter.getParameterTypes().length == 1) { Class type = setter.getParameterTypes()[0]; - String property = StringUtils.camelToSplitName(name.substring(3, 4).toLowerCase() + name.substring(4), "-"); + String property = StringUtils.camelToSplitName(name.substring(3, 4).toLowerCase() + name.substring(4), "-"); props.add(property); Method getter = null; try { @@ -161,7 +162,7 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { parseMethods(id, element.getChildNodes(), beanDefinition, parserContext); } else if ("arguments".equals(property)) { parseArguments(id, element.getChildNodes(), beanDefinition, parserContext); - } else { + } else { String value = element.getAttribute(property); if (value != null) { value = value.trim(); @@ -200,11 +201,11 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { ProtocolConfig protocol = new ProtocolConfig(); protocol.setName(value); reference = protocol; - } else if ("monitor".equals(property) - && (! parserContext.getRegistry().containsBeanDefinition(value) - || ! MonitorConfig.class.getName().equals(parserContext.getRegistry().getBeanDefinition(value).getBeanClassName()))) { - // 兼容旧版本配置 - reference = convertMonitor(value); + } else if ("monitor".equals(property) + && (! parserContext.getRegistry().containsBeanDefinition(value) + || ! MonitorConfig.class.getName().equals(parserContext.getRegistry().getBeanDefinition(value).getBeanClassName()))) { + // 兼容旧版本配置 + reference = convertMonitor(value); } else if ("onreturn".equals(property)) { int index = value.lastIndexOf("."); String returnRef = value.substring(0, index); @@ -216,7 +217,7 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { String throwRef = value.substring(0, index); String throwMethod = value.substring(index + 1); reference = new RuntimeBeanReference(throwRef); - beanDefinition.getPropertyValues().addPropertyValue("onthrowMethod", throwMethod); + beanDefinition.getPropertyValues().addPropertyValue("onthrowMethod", throwMethod); } else { if ("ref".equals(property) && parserContext.getRegistry().containsBeanDefinition(value)) { BeanDefinition refBean = parserContext.getRegistry().getBeanDefinition(value); @@ -232,50 +233,50 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { } } } - } - NamedNodeMap attributes = element.getAttributes(); - int len = attributes.getLength(); - for (int i = 0; i < len; i++) { - Node node = attributes.item(i); - String name = node.getLocalName(); - if (! props.contains(name)) { - if (parameters == null) { - parameters = new ManagedMap(); - } - String value = node.getNodeValue(); - parameters.put(name, new TypedStringValue(value, String.class)); - } - } - if (parameters != null) { - beanDefinition.getPropertyValues().addPropertyValue("parameters", parameters); + } + NamedNodeMap attributes = element.getAttributes(); + int len = attributes.getLength(); + for (int i = 0; i < len; i++) { + Node node = attributes.item(i); + String name = node.getLocalName(); + if (! props.contains(name)) { + if (parameters == null) { + parameters = new ManagedMap(); + } + String value = node.getNodeValue(); + parameters.put(name, new TypedStringValue(value, String.class)); + } + } + if (parameters != null) { + beanDefinition.getPropertyValues().addPropertyValue("parameters", parameters); } return beanDefinition; - } - - private static final Pattern GROUP_AND_VERION = Pattern.compile("^[\\-.0-9_a-zA-Z]+(\\:[\\-.0-9_a-zA-Z]+)?$"); - - protected static MonitorConfig convertMonitor(String monitor) { - if (monitor == null || monitor.length() == 0) { - return null; - } - if (GROUP_AND_VERION.matcher(monitor).matches()) { - String group; - String version; - int i = monitor.indexOf(':'); - if (i > 0) { - group = monitor.substring(0, i); - version = monitor.substring(i + 1); - } else { - group = monitor; - version = null; - } - MonitorConfig monitorConfig = new MonitorConfig(); - monitorConfig.setGroup(group); - monitorConfig.setVersion(version); - return monitorConfig; - } - return null; - } + } + + private static final Pattern GROUP_AND_VERION = Pattern.compile("^[\\-.0-9_a-zA-Z]+(\\:[\\-.0-9_a-zA-Z]+)?$"); + + protected static MonitorConfig convertMonitor(String monitor) { + if (monitor == null || monitor.length() == 0) { + return null; + } + if (GROUP_AND_VERION.matcher(monitor).matches()) { + String group; + String version; + int i = monitor.indexOf(':'); + if (i > 0) { + group = monitor.substring(0, i); + version = monitor.substring(i + 1); + } else { + group = monitor; + version = null; + } + MonitorConfig monitorConfig = new MonitorConfig(); + monitorConfig.setGroup(group); + monitorConfig.setVersion(version); + return monitorConfig; + } + return null; + } private static boolean isPrimitive(Class cls) { return cls.isPrimitive() || cls == Boolean.class || cls == Byte.class @@ -299,58 +300,58 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { } } beanDefinition.getPropertyValues().addPropertyValue(property, list); - } - - private static void parseNested(Element element, ParserContext parserContext, Class beanClass, boolean required, String tag, String property, String ref, BeanDefinition beanDefinition) { - NodeList nodeList = element.getChildNodes(); - if (nodeList != null && nodeList.getLength() > 0) { - boolean first = true; - for (int i = 0; i < nodeList.getLength(); i++) { - Node node = nodeList.item(i); - if (node instanceof Element) { - if (tag.equals(node.getNodeName()) - || tag.equals(node.getLocalName())) { - if (first) { - first = false; - String isDefault = element.getAttribute("default"); - if (isDefault == null || isDefault.length() == 0) { - beanDefinition.getPropertyValues().addPropertyValue("default", "false"); - } - } - BeanDefinition subDefinition = parse((Element) node, parserContext, beanClass, required); - if (subDefinition != null && ref != null && ref.length() > 0) { - subDefinition.getPropertyValues().addPropertyValue(property, new RuntimeBeanReference(ref)); - } - } - } - } - } } - - private static void parseProperties(NodeList nodeList, RootBeanDefinition beanDefinition) { - if (nodeList != null && nodeList.getLength() > 0) { - for (int i = 0; i < nodeList.getLength(); i++) { - Node node = nodeList.item(i); - if (node instanceof Element) { - if ("property".equals(node.getNodeName()) - || "property".equals(node.getLocalName())) { - String name = ((Element) node).getAttribute("name"); - if (name != null && name.length() > 0) { - String value = ((Element) node).getAttribute("value"); - String ref = ((Element) node).getAttribute("ref"); - if (value != null && value.length() > 0) { - beanDefinition.getPropertyValues().addPropertyValue(name, value); - } else if (ref != null && ref.length() > 0) { - beanDefinition.getPropertyValues().addPropertyValue(name, new RuntimeBeanReference(ref)); - } else { - throw new UnsupportedOperationException("Unsupported sub tag, Only supported or "); - } - } - } - } - } - } - } + + private static void parseNested(Element element, ParserContext parserContext, Class beanClass, boolean required, String tag, String property, String ref, BeanDefinition beanDefinition) { + NodeList nodeList = element.getChildNodes(); + if (nodeList != null && nodeList.getLength() > 0) { + boolean first = true; + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if (node instanceof Element) { + if (tag.equals(node.getNodeName()) + || tag.equals(node.getLocalName())) { + if (first) { + first = false; + String isDefault = element.getAttribute("default"); + if (isDefault == null || isDefault.length() == 0) { + beanDefinition.getPropertyValues().addPropertyValue("default", "false"); + } + } + BeanDefinition subDefinition = parse((Element) node, parserContext, beanClass, required); + if (subDefinition != null && ref != null && ref.length() > 0) { + subDefinition.getPropertyValues().addPropertyValue(property, new RuntimeBeanReference(ref)); + } + } + } + } + } + } + + private static void parseProperties(NodeList nodeList, RootBeanDefinition beanDefinition) { + if (nodeList != null && nodeList.getLength() > 0) { + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if (node instanceof Element) { + if ("property".equals(node.getNodeName()) + || "property".equals(node.getLocalName())) { + String name = ((Element) node).getAttribute("name"); + if (name != null && name.length() > 0) { + String value = ((Element) node).getAttribute("value"); + String ref = ((Element) node).getAttribute("ref"); + if (value != null && value.length() > 0) { + beanDefinition.getPropertyValues().addPropertyValue(name, value); + } else if (ref != null && ref.length() > 0) { + beanDefinition.getPropertyValues().addPropertyValue(name, new RuntimeBeanReference(ref)); + } else { + throw new UnsupportedOperationException("Unsupported sub tag, Only supported or "); + } + } + } + } + } + } + } @SuppressWarnings("unchecked") private static ManagedMap parseParameters(NodeList nodeList, RootBeanDefinition beanDefinition) { @@ -373,9 +374,9 @@ public class DubboBeanDefinitionParser implements BeanDefinitionParser { parameters.put(key, new TypedStringValue(value, String.class)); } } - } + } return parameters; - } + } return null; } diff --git a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.java b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.java index 4194533b9f..4afe4a4282 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/schema/DubboNamespaceHandler.java @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.config.spring.schema; - +package com.alibaba.dubbo.config.spring.schema; + import org.springframework.beans.factory.xml.NamespaceHandlerSupport; import com.alibaba.dubbo.common.Version; @@ -28,18 +28,19 @@ import com.alibaba.dubbo.config.RegistryConfig; import com.alibaba.dubbo.config.spring.AnnotationBean; import com.alibaba.dubbo.config.spring.ReferenceBean; import com.alibaba.dubbo.config.spring.ServiceBean; - -/** - * DubboNamespaceHandler - * - * @author william.liangf - */ -public class DubboNamespaceHandler extends NamespaceHandlerSupport { - - static { - Version.checkDuplicate(DubboNamespaceHandler.class); - } - + +/** + * DubboNamespaceHandler + * + * @author william.liangf + * @export + */ +public class DubboNamespaceHandler extends NamespaceHandlerSupport { + + static { + Version.checkDuplicate(DubboNamespaceHandler.class); + } + public void init() { registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true)); registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true)); @@ -52,5 +53,5 @@ public class DubboNamespaceHandler extends NamespaceHandlerSupport { registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false)); registerBeanDefinitionParser("annotation", new DubboBeanDefinitionParser(AnnotationBean.class, true)); } - + } \ No newline at end of file diff --git a/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/Cache.java b/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/Cache.java index 61a0399a75..841feb2bc3 100644 --- a/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/Cache.java +++ b/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/Cache.java @@ -19,6 +19,7 @@ package com.alibaba.dubbo.cache; * Cache * * @author william.liangf + * @export */ public interface Cache { diff --git a/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/CacheFactory.java b/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/CacheFactory.java index 0bdd4713c2..51aeb40f19 100644 --- a/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/CacheFactory.java +++ b/dubbo-filter/dubbo-filter-cache/src/main/java/com/alibaba/dubbo/cache/CacheFactory.java @@ -23,6 +23,7 @@ import com.alibaba.dubbo.common.extension.SPI; * CacheFactory * * @author william.liangf + * @export */ @SPI("lru") public interface CacheFactory { diff --git a/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validation.java b/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validation.java index 107fd2c9f6..f545c4eed6 100644 --- a/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validation.java +++ b/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validation.java @@ -24,6 +24,7 @@ import com.alibaba.dubbo.common.extension.SPI; * Validation * * @author william.liangf + * @export */ @SPI("jvalidation") public interface Validation { diff --git a/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validator.java b/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validator.java index 528e054ef0..f4fc2db969 100644 --- a/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validator.java +++ b/dubbo-filter/dubbo-filter-validation/src/main/java/com/alibaba/dubbo/validation/Validator.java @@ -19,6 +19,7 @@ package com.alibaba.dubbo.validation; * Validator * * @author william.liangf + * @export */ public interface Validator { diff --git a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/Monitor.java b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/Monitor.java index 0c12a53cc5..0404a9a8f1 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/Monitor.java +++ b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/Monitor.java @@ -22,6 +22,7 @@ import com.alibaba.dubbo.common.Node; * * @see com.alibaba.dubbo.monitor.MonitorFactory#getMonitor(com.alibaba.dubbo.common.URL) * @author william.liangf + * @export */ public interface Monitor extends Node, MonitorService { diff --git a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorFactory.java b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorFactory.java index d61fb01989..9c23a15e8f 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorFactory.java +++ b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorFactory.java @@ -23,6 +23,7 @@ import com.alibaba.dubbo.common.extension.SPI; * MonitorFactory. (SPI, Singleton, ThreadSafe) * * @author william.liangf + * @export */ @SPI("dubbo") public interface MonitorFactory { diff --git a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorService.java b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorService.java index be2b7c4001..277aae651e 100644 --- a/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorService.java +++ b/dubbo-monitor/dubbo-monitor-api/src/main/java/com/alibaba/dubbo/monitor/MonitorService.java @@ -21,6 +21,7 @@ import com.alibaba.dubbo.common.URL; * MonitorService. (SPI, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface MonitorService { diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java index 3e633a3152..6990bc9b8e 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/NotifyListener.java @@ -13,21 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.registry; - +package com.alibaba.dubbo.registry; + import java.util.List; import com.alibaba.dubbo.common.URL; - -/** - * NotifyListener. (API, Prototype, ThreadSafe) - * - * @see com.alibaba.dubbo.registry.RegistryService#subscribe(URL, NotifyListener) - * @author william.liangf - */ -public interface NotifyListener { - - /** + +/** + * NotifyListener. (API, Prototype, ThreadSafe) + * + * @see com.alibaba.dubbo.registry.RegistryService#subscribe(URL, NotifyListener) + * @author william.liangf + * @export + */ +public interface NotifyListener { + + /** * 当收到服务变更通知时触发。 * * 通知需处理契约:
@@ -37,8 +38,8 @@ public interface NotifyListener { * 4. 如果一种类型的数据为空,需通知一个empty协议并带category参数的标识性URL数据。
* 5. 通知者(即注册中心实现)需保证通知的顺序,比如:单线程推送,队列串行化,带版本对比。
* - * @param urls 已注册信息列表,总不为空,含义同{@link com.alibaba.dubbo.registry.RegistryService#lookup(URL)}的返回值。 - */ - void notify(List urls); - + * @param urls 已注册信息列表,总不为空,含义同{@link com.alibaba.dubbo.registry.RegistryService#lookup(URL)}的返回值。 + */ + void notify(List urls); + } \ No newline at end of file diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/Registry.java b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/Registry.java index 7211b75ec9..6d0190846f 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/Registry.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/Registry.java @@ -13,17 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.registry; - +package com.alibaba.dubbo.registry; + import com.alibaba.dubbo.common.Node; import com.alibaba.dubbo.common.URL; - -/** - * Registry. (SPI, Prototype, ThreadSafe) + +/** + * Registry. (SPI, Prototype, ThreadSafe) * - * @see com.alibaba.dubbo.registry.RegistryFactory#getRegistry(URL) + * @see com.alibaba.dubbo.registry.RegistryFactory#getRegistry(URL) * @see com.alibaba.dubbo.registry.support.AbstractRegistry - * @author william.liangf - */ -public interface Registry extends Node, RegistryService { + * @author william.liangf + * @export + */ +public interface Registry extends Node, RegistryService { } \ No newline at end of file diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryFactory.java b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryFactory.java index d1703e485e..5c96180fdc 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryFactory.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryFactory.java @@ -24,6 +24,7 @@ import com.alibaba.dubbo.common.extension.SPI; * * @see com.alibaba.dubbo.registry.support.AbstractRegistryFactory * @author william.liangf + * @export */ @SPI("dubbo") public interface RegistryFactory { diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryService.java b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryService.java index 4f1a67e95f..0615d3913f 100644 --- a/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryService.java +++ b/dubbo-registry/dubbo-registry-api/src/main/java/com/alibaba/dubbo/registry/RegistryService.java @@ -25,6 +25,7 @@ import com.alibaba.dubbo.common.URL; * @see com.alibaba.dubbo.registry.Registry * @see com.alibaba.dubbo.registry.RegistryFactory#getRegistry(URL) * @author william.liangf + * @export */ public interface RegistryService { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Channel.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Channel.java index 8a4e4bb000..87665b83eb 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Channel.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Channel.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; import java.net.InetSocketAddress; @@ -25,6 +25,7 @@ import java.net.InetSocketAddress; * @see com.alibaba.dubbo.remoting.Server#getChannel(InetSocketAddress) * @author qian.lei * @author william.liangf + * @export */ public interface Channel extends Endpoint { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ChannelHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ChannelHandler.java index ee663ac4cd..3e78cac9ec 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ChannelHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ChannelHandler.java @@ -1,21 +1,21 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; - -import com.alibaba.dubbo.common.extension.SPI; + +import com.alibaba.dubbo.common.extension.SPI; /** @@ -25,7 +25,8 @@ import com.alibaba.dubbo.common.extension.SPI; * @see com.alibaba.dubbo.remoting.Transporter#connect(com.alibaba.dubbo.common.URL, ChannelHandler) * @author qian.lei * @author william.liangf - */ + * @export + */ @SPI public interface ChannelHandler { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Client.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Client.java index f547b8a8d6..3a1464c6e0 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Client.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Client.java @@ -24,6 +24,7 @@ import com.alibaba.dubbo.common.Resetable; * * @see com.alibaba.dubbo.remoting.Transporter#connect(com.alibaba.dubbo.common.URL, ChannelHandler) * @author qian.lei + * @export */ public interface Client extends Endpoint, Channel, Resetable { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Codec.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Codec.java index 7145a93674..56d7b23f07 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Codec.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Codec.java @@ -1,27 +1,27 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.common.extension.Adaptive; -import com.alibaba.dubbo.common.extension.SPI; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.extension.Adaptive; +import com.alibaba.dubbo.common.extension.SPI; /** * Codec. (SPI, Singleton, ThreadSafe) @@ -29,8 +29,9 @@ import com.alibaba.dubbo.common.extension.SPI; * @author qianlei * @author ding.lid * @author william.liangf - */ -@SPI + * @export + */ +@SPI public interface Codec { /** diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Dispather.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Dispather.java index 78fc371062..9589d9fa10 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Dispather.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Dispather.java @@ -1,30 +1,31 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; -import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.common.URL; -import com.alibaba.dubbo.common.extension.Adaptive; -import com.alibaba.dubbo.common.extension.SPI; -import com.alibaba.dubbo.remoting.transport.dispather.all.AllDispather; +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.common.extension.Adaptive; +import com.alibaba.dubbo.common.extension.SPI; +import com.alibaba.dubbo.remoting.transport.dispather.all.AllDispather; /** * ChannelHandlerWrapper (SPI, Singleton, ThreadSafe) * * @author chao.liuc + * @export */ @SPI(AllDispather.NAME) public interface Dispather { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Endpoint.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Endpoint.java index 267ad3031e..06423bda3b 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Endpoint.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Endpoint.java @@ -26,6 +26,7 @@ import com.alibaba.dubbo.common.URL; * @see com.alibaba.dubbo.remoting.Client * @see com.alibaba.dubbo.remoting.Server * @author william.liangf + * @export */ public interface Endpoint { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ExecutionException.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ExecutionException.java index c54f6e4aa7..86963866a9 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ExecutionException.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/ExecutionException.java @@ -21,6 +21,7 @@ import java.net.InetSocketAddress; * ReceiveException * * @author william.liangf + * @export */ public class ExecutionException extends RemotingException { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/RemotingException.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/RemotingException.java index 7180b62918..ebdb50f5d8 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/RemotingException.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/RemotingException.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; import java.net.InetSocketAddress; @@ -28,6 +28,7 @@ import java.net.InetSocketAddress; * @see com.alibaba.dubbo.remoting.Transporter#bind(com.alibaba.dubbo.common.URL, ChannelHandler) * @see com.alibaba.dubbo.remoting.Transporter#connect(com.alibaba.dubbo.common.URL, ChannelHandler) * @author qian.lei + * @export */ public class RemotingException extends Exception { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Server.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Server.java index afe655a78a..402b1c6921 100755 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Server.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Server.java @@ -27,6 +27,7 @@ import com.alibaba.dubbo.common.Resetable; * * @see com.alibaba.dubbo.remoting.Transporter#bind(com.alibaba.dubbo.common.URL, ChannelHandler) * @author qian.lei + * @export */ public interface Server extends Endpoint, Resetable { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/TimeoutException.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/TimeoutException.java index 1b20999536..f2ae4ed037 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/TimeoutException.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/TimeoutException.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; import java.net.InetSocketAddress; @@ -23,6 +23,7 @@ import java.net.InetSocketAddress; * @see com.alibaba.dubbo.remoting.exchange.ResponseFuture#get() * @see com.alibaba.dubbo.remoting.exchange.ResponseFuture#get(int) * @author qian.lei + * @export */ public class TimeoutException extends RemotingException { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Transporter.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Transporter.java index f8326159b3..52f46543c9 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Transporter.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/Transporter.java @@ -1,26 +1,26 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.remoting; -import javax.sound.midi.Receiver; - -import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.common.URL; -import com.alibaba.dubbo.common.extension.Adaptive; -import com.alibaba.dubbo.common.extension.SPI; +import javax.sound.midi.Receiver; + +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.common.extension.Adaptive; +import com.alibaba.dubbo.common.extension.SPI; /** * Transporter. (SPI, Singleton, ThreadSafe) @@ -31,6 +31,7 @@ import com.alibaba.dubbo.common.extension.SPI; * @see com.alibaba.dubbo.remoting.Transporters * @author ding.lid * @author william.liangf + * @export */ @SPI("netty") public interface Transporter { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeChannel.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeChannel.java index b62cb2c763..c2fb8490bb 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeChannel.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeChannel.java @@ -22,6 +22,7 @@ import com.alibaba.dubbo.remoting.RemotingException; * ExchangeChannel. (API/SPI, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface ExchangeChannel extends Channel { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeClient.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeClient.java index 6e0d61c7d4..d9ad634ceb 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeClient.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeClient.java @@ -21,6 +21,7 @@ import com.alibaba.dubbo.remoting.Client; * ExchangeClient. (API/SPI, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface ExchangeClient extends Client, ExchangeChannel { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeHandler.java index b5e183bf77..4f65daa90a 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeHandler.java @@ -23,6 +23,7 @@ import com.alibaba.dubbo.remoting.telnet.TelnetHandler; * ExchangeHandler. (API, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface ExchangeHandler extends ChannelHandler, TelnetHandler { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeServer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeServer.java index 55ff1ba549..0784e50268 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeServer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ExchangeServer.java @@ -24,6 +24,7 @@ import com.alibaba.dubbo.remoting.Server; * ExchangeServer. (API/SPI, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface ExchangeServer extends Server { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/Exchanger.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/Exchanger.java index c303e42040..91b77f9516 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/Exchanger.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/Exchanger.java @@ -29,6 +29,7 @@ import com.alibaba.dubbo.remoting.exchange.support.header.HeaderExchanger; * Request-Response * * @author william.liangf + * @export */ @SPI(HeaderExchanger.NAME) public interface Exchanger { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseFuture.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseFuture.java index 69eb691c6c..11da45775f 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseFuture.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/ResponseFuture.java @@ -24,6 +24,7 @@ import com.alibaba.dubbo.remoting.RemotingException; * @see com.alibaba.dubbo.remoting.exchange.ExchangeChannel#request(Object, int) * @author qian.lei * @author william.liangf + * @export */ public interface ResponseFuture { diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/Replier.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/Replier.java index 01a3c95cd0..ea5cf2cfff 100755 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/Replier.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/com/alibaba/dubbo/remoting/exchange/support/Replier.java @@ -22,6 +22,7 @@ import com.alibaba.dubbo.remoting.exchange.ExchangeChannel; * Replier. (API, Prototype, ThreadSafe) * * @author william.liangf + * @export */ public interface Replier { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Exporter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Exporter.java index 1494390a42..01667f599a 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Exporter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Exporter.java @@ -22,6 +22,7 @@ package com.alibaba.dubbo.rpc; * @see com.alibaba.dubbo.rpc.ExporterListener * @see com.alibaba.dubbo.rpc.protocol.AbstractExporter * @author william.liangf + * @export */ public interface Exporter { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ExporterListener.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ExporterListener.java index 7c9ec82cba..571c119e13 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ExporterListener.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ExporterListener.java @@ -21,6 +21,7 @@ import com.alibaba.dubbo.common.extension.SPI; * ExporterListener. (SPI, Singleton, ThreadSafe) * * @author william.liangf + * @export */ @SPI public interface ExporterListener { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Filter.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Filter.java index e57d6c744b..a7787aeecc 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Filter.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Filter.java @@ -13,34 +13,35 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc; +package com.alibaba.dubbo.rpc; import com.alibaba.dubbo.common.extension.SPI; -/** - * Filter. (SPI, Singleton, ThreadSafe) - * - * @author william.liangf +/** + * Filter. (SPI, Singleton, ThreadSafe) + * + * @author william.liangf + * @export */ @SPI -public interface Filter { - - /** - * do invoke filter. - * +public interface Filter { + + /** + * do invoke filter. + * * - * // before filter + * // before filter * Result result = invoker.invoke(invocation); * // after filter - * return result; - * - * - * @see com.alibaba.dubbo.rpc.Invoker#invoke(Invocation) - * @param invoker service - * @param invocation invocation. - * @return invoke result. - * @throws RpcException + * return result; + * + * + * @see com.alibaba.dubbo.rpc.Invoker#invoke(Invocation) + * @param invoker service + * @param invocation invocation. + * @return invoke result. + * @throws RpcException */ - Result invoke(Invoker invoker, Invocation invocation) throws RpcException; - + Result invoke(Invoker invoker, Invocation invocation) throws RpcException; + } \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invocation.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invocation.java index 94ca82d07d..1584d93216 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invocation.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invocation.java @@ -13,51 +13,52 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc; - -import java.util.Map; +package com.alibaba.dubbo.rpc; -/** - * Invocation. (API, Prototype, NonThreadSafe) - * - * @serial Don't change the class name and package name. - * @see com.alibaba.dubbo.rpc.Invoker#invoke(Invocation) - * @see com.alibaba.dubbo.rpc.RpcInvocation - * @author qian.lei - * @author william.liangf - */ +import java.util.Map; + +/** + * Invocation. (API, Prototype, NonThreadSafe) + * + * @serial Don't change the class name and package name. + * @see com.alibaba.dubbo.rpc.Invoker#invoke(Invocation) + * @see com.alibaba.dubbo.rpc.RpcInvocation + * @author qian.lei + * @author william.liangf + * @export + */ public interface Invocation { - - /** - * get method name. + + /** + * get method name. * - * @serial - * @return method name. - */ - String getMethodName(); - - /** - * get parameter types. + * @serial + * @return method name. + */ + String getMethodName(); + + /** + * get parameter types. * - * @serial - * @return parameter types. - */ - Class[] getParameterTypes(); - - /** - * get arguments. + * @serial + * @return parameter types. + */ + Class[] getParameterTypes(); + + /** + * get arguments. * - * @serial - * @return arguments. - */ - Object[] getArguments(); - - /** - * get attachments. + * @serial + * @return arguments. + */ + Object[] getArguments(); + + /** + * get attachments. * - * @serial - * @return attachments. - */ + * @serial + * @return attachments. + */ Map getAttachments(); /** @@ -83,5 +84,5 @@ public interface Invocation { * @return invoker. */ Invoker getInvoker(); - + } \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invoker.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invoker.java index d675bc158d..f52f88c31e 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invoker.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Invoker.java @@ -24,6 +24,7 @@ import com.alibaba.dubbo.common.Node; * @see com.alibaba.dubbo.rpc.InvokerListener * @see com.alibaba.dubbo.rpc.protocol.AbstractInvoker * @author william.liangf + * @export */ public interface Invoker extends Node { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/InvokerListener.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/InvokerListener.java index 1200b6ab58..a4e0bd13e9 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/InvokerListener.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/InvokerListener.java @@ -22,6 +22,7 @@ import com.alibaba.dubbo.common.extension.SPI; * InvokerListener. (SPI, Singleton, ThreadSafe) * * @author william.liangf + * @export */ @SPI public interface InvokerListener { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Protocol.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Protocol.java index 8da6bd89cf..e1f26413f2 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Protocol.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Protocol.java @@ -13,26 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc; - +package com.alibaba.dubbo.rpc; + import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.extension.Adaptive; import com.alibaba.dubbo.common.extension.SPI; - -/** - * Protocol. (API/SPI, Singleton, ThreadSafe) - * - * @author william.liangf + +/** + * Protocol. (API/SPI, Singleton, ThreadSafe) + * + * @author william.liangf + * @export */ -@SPI("dubbo") -public interface Protocol { - - /** - * 获取缺省端口,当用户没有配置端口时使用。 - * - * @return 缺省端口 - */ - int getDefaultPort(); +@SPI("dubbo") +public interface Protocol { + + /** + * 获取缺省端口,当用户没有配置端口时使用。 + * + * @return 缺省端口 + */ + int getDefaultPort(); /** * 暴露远程服务:
@@ -62,13 +63,13 @@ public interface Protocol { */ @Adaptive Invoker refer(Class type, URL url) throws RpcException; - + /** * 释放协议:
- * 1. 取消该协议所有已经暴露和引用的服务。
+ * 1. 取消该协议所有已经暴露和引用的服务。
* 2. 释放协议所占用的所有资源,比如连接和端口。
- * 3. 协议在释放后,依然能暴露和引用新的服务。
- */ - void destroy(); - + * 3. 协议在释放后,依然能暴露和引用新的服务。
+ */ + void destroy(); + } \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ProxyFactory.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ProxyFactory.java index 2cc798d4af..32af836276 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ProxyFactory.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/ProxyFactory.java @@ -1,29 +1,30 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.rpc; -import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.common.URL; -import com.alibaba.dubbo.common.extension.Adaptive; -import com.alibaba.dubbo.common.extension.SPI; +import com.alibaba.dubbo.common.Constants; +import com.alibaba.dubbo.common.URL; +import com.alibaba.dubbo.common.extension.Adaptive; +import com.alibaba.dubbo.common.extension.SPI; /** * ProxyFactory. (API/SPI, Singleton, ThreadSafe) * * @author william.liangf + * @export */ @SPI("javassist") public interface ProxyFactory { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Result.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Result.java index 174ab9d846..a4850d23f6 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Result.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/Result.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.rpc; /** @@ -23,6 +23,7 @@ package com.alibaba.dubbo.rpc; * @see com.alibaba.dubbo.rpc.RpcResult * @author qianlei * @author william.liangf + * @export */ public interface Result { @@ -31,7 +32,7 @@ public interface Result { * * @return result. if no result return null. */ - Object getValue(); + Object getValue(); /** * Get exception. @@ -39,13 +40,13 @@ public interface Result { * @return exception. if no exception return null. */ Throwable getException(); - - /** - * Has exception. - * - * @return has exception. - */ - boolean hasException(); + + /** + * Has exception. + * + * @return has exception. + */ + boolean hasException(); /** * Recreate. @@ -56,18 +57,18 @@ public interface Result { * } else { * return getValue(); * } - * - * - * @return result. + * + * + * @return result. * @throws if has exception throw it. */ Object recreate() throws Throwable; - - /** - * @deprecated Replace to getValue() - * @see com.alibaba.dubbo.rpc.Result#getValue() - */ - @Deprecated - Object getResult(); + + /** + * @deprecated Replace to getValue() + * @see com.alibaba.dubbo.rpc.Result#getValue() + */ + @Deprecated + Object getResult(); } \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java index eaf72c22b3..b035dd0da7 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcContext.java @@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.alibaba.dubbo.rpc; - +package com.alibaba.dubbo.rpc; + import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Arrays; @@ -31,43 +31,44 @@ import java.util.concurrent.TimeoutException; import com.alibaba.dubbo.common.Constants; import com.alibaba.dubbo.common.URL; import com.alibaba.dubbo.common.utils.NetUtils; - -/** + +/** * Thread local context. (API, ThreadLocal, ThreadSafe) * * 注意:RpcContext是一个临时状态记录器,当接收到RPC请求,或发起RPC请求时,RpcContext的状态都会变化。 - * 比如:A调B,B再调C,则B机器上,在B调C之前,RpcContext记录的是A调B的信息,在B调C之后,RpcContext记录的是B调C的信息。 - * - * @see com.alibaba.dubbo.rpc.filter.ContextFilter - * @author qian.lei - * @author william.liangf - */ -public class RpcContext { - - private static final ThreadLocal LOCAL = new ThreadLocal() { - @Override - protected RpcContext initialValue() { - return new RpcContext(); - } - }; - - /** - * get context. - * - * @return context - */ - public static RpcContext getContext() { - return LOCAL.get(); - } - - /** - * remove context. - * - * @see com.alibaba.dubbo.rpc.filter.ContextFilter - */ - public static void removeContext() { - LOCAL.remove(); - } + * 比如:A调B,B再调C,则B机器上,在B调C之前,RpcContext记录的是A调B的信息,在B调C之后,RpcContext记录的是B调C的信息。 + * + * @see com.alibaba.dubbo.rpc.filter.ContextFilter + * @author qian.lei + * @author william.liangf + * @export + */ +public class RpcContext { + + private static final ThreadLocal LOCAL = new ThreadLocal() { + @Override + protected RpcContext initialValue() { + return new RpcContext(); + } + }; + + /** + * get context. + * + * @return context + */ + public static RpcContext getContext() { + return LOCAL.get(); + } + + /** + * remove context. + * + * @see com.alibaba.dubbo.rpc.filter.ContextFilter + */ + public static void removeContext() { + LOCAL.remove(); + } private Future future; @@ -80,10 +81,10 @@ public class RpcContext { private Class[] parameterTypes; private Object[] arguments; - - private InetSocketAddress localAddress; - - private InetSocketAddress remoteAddress; + + private InetSocketAddress localAddress; + + private InetSocketAddress remoteAddress; private final Map attachments = new HashMap(); @@ -97,9 +98,9 @@ public class RpcContext { @Deprecated private Invocation invocation; - - protected RpcContext() { - } + + protected RpcContext() { + } /** * is provider side. @@ -123,7 +124,7 @@ public class RpcContext { } return url.getPort() != address.getPort() || ! NetUtils.filterLocalHost(url.getIp()).equals(NetUtils.filterLocalHost(host)); - } + } /** * is consumer side. @@ -179,7 +180,7 @@ public class RpcContext { public URL getUrl() { return url; - } + } public void setUrl(URL url) { this.url = url; @@ -223,155 +224,155 @@ public class RpcContext { public void setArguments(Object[] arguments) { this.arguments = arguments; } - - /** - * set local address. - * - * @param address - * @return context - */ - public RpcContext setLocalAddress(InetSocketAddress address) { - this.localAddress = address; - return this; - } - - /** - * set local address. - * - * @param host - * @param port - * @return context - */ - public RpcContext setLocalAddress(String host, int port) { - if (port < 0) { - port = 0; - } - this.localAddress = InetSocketAddress.createUnresolved(host, port); - return this; - } - - /** - * get local address. - * - * @return local address - */ - public InetSocketAddress getLocalAddress() { - return localAddress; - } - - public String getLocalAddressString() { - return getLocalHost() + ":" + getLocalPort(); - } - - /** - * get local host name. - * - * @return local host name - */ - public String getLocalHostName() { - String host = localAddress == null ? null : localAddress.getHostName(); - if (host == null || host.length() == 0) { - return getLocalHost(); - } - return host; - } - - /** - * set remote address. - * - * @param address - * @return context - */ - public RpcContext setRemoteAddress(InetSocketAddress address) { - this.remoteAddress = address; - return this; - } - - /** - * set remote address. - * - * @param host - * @param port - * @return context - */ - public RpcContext setRemoteAddress(String host, int port) { - if (port < 0) { - port = 0; - } - this.remoteAddress = InetSocketAddress.createUnresolved(host, port); - return this; - } - - /** - * get remote address. - * - * @return remote address - */ - public InetSocketAddress getRemoteAddress() { - return remoteAddress; - } - - /** - * get remote address string. - * - * @return remote address string. - */ - public String getRemoteAddressString() { - return getRemoteHost() + ":" + getRemotePort(); - } - - /** - * get remote host name. - * - * @return remote host name - */ - public String getRemoteHostName() { - return remoteAddress == null ? null : remoteAddress.getHostName(); - } - - /** - * get local host. - * - * @return local host - */ - public String getLocalHost() { - String host = localAddress == null ? null : + + /** + * set local address. + * + * @param address + * @return context + */ + public RpcContext setLocalAddress(InetSocketAddress address) { + this.localAddress = address; + return this; + } + + /** + * set local address. + * + * @param host + * @param port + * @return context + */ + public RpcContext setLocalAddress(String host, int port) { + if (port < 0) { + port = 0; + } + this.localAddress = InetSocketAddress.createUnresolved(host, port); + return this; + } + + /** + * get local address. + * + * @return local address + */ + public InetSocketAddress getLocalAddress() { + return localAddress; + } + + public String getLocalAddressString() { + return getLocalHost() + ":" + getLocalPort(); + } + + /** + * get local host name. + * + * @return local host name + */ + public String getLocalHostName() { + String host = localAddress == null ? null : localAddress.getHostName(); + if (host == null || host.length() == 0) { + return getLocalHost(); + } + return host; + } + + /** + * set remote address. + * + * @param address + * @return context + */ + public RpcContext setRemoteAddress(InetSocketAddress address) { + this.remoteAddress = address; + return this; + } + + /** + * set remote address. + * + * @param host + * @param port + * @return context + */ + public RpcContext setRemoteAddress(String host, int port) { + if (port < 0) { + port = 0; + } + this.remoteAddress = InetSocketAddress.createUnresolved(host, port); + return this; + } + + /** + * get remote address. + * + * @return remote address + */ + public InetSocketAddress getRemoteAddress() { + return remoteAddress; + } + + /** + * get remote address string. + * + * @return remote address string. + */ + public String getRemoteAddressString() { + return getRemoteHost() + ":" + getRemotePort(); + } + + /** + * get remote host name. + * + * @return remote host name + */ + public String getRemoteHostName() { + return remoteAddress == null ? null : remoteAddress.getHostName(); + } + + /** + * get local host. + * + * @return local host + */ + public String getLocalHost() { + String host = localAddress == null ? null : localAddress.getAddress() == null ? localAddress.getHostName() - : NetUtils.filterLocalHost(localAddress.getAddress().getHostAddress()); - if (host == null || host.length() == 0) { - return NetUtils.getLocalHost(); - } - return host; - } - - /** - * get local port. - * - * @return port - */ - public int getLocalPort() { - return localAddress == null ? 0 : localAddress.getPort(); - } - - /** - * get remote host. - * - * @return remote host - */ - public String getRemoteHost() { - return remoteAddress == null ? null : + : NetUtils.filterLocalHost(localAddress.getAddress().getHostAddress()); + if (host == null || host.length() == 0) { + return NetUtils.getLocalHost(); + } + return host; + } + + /** + * get local port. + * + * @return port + */ + public int getLocalPort() { + return localAddress == null ? 0 : localAddress.getPort(); + } + + /** + * get remote host. + * + * @return remote host + */ + public String getRemoteHost() { + return remoteAddress == null ? null : remoteAddress.getAddress() == null ? remoteAddress.getHostName() - : NetUtils.filterLocalHost(remoteAddress.getAddress().getHostAddress()); - } - - /** - * get remote port. - * - * @return remote port - */ - public int getRemotePort() { - return remoteAddress == null ? 0 : remoteAddress.getPort(); - } + : NetUtils.filterLocalHost(remoteAddress.getAddress().getHostAddress()); + } + + /** + * get remote port. + * + * @return remote port + */ + public int getRemotePort() { + return remoteAddress == null ? 0 : remoteAddress.getPort(); + } /** * get attachment. @@ -382,33 +383,33 @@ public class RpcContext { public String getAttachment(String key) { return attachments.get(key); } - - /** - * set attachment. - * - * @param key - * @param value - * @return context - */ - public RpcContext setAttachment(String key, String value) { - if (value == null) { - attachments.remove(key); - } else { - attachments.put(key, value); - } - return this; - } - - /** - * remove attachment. - * - * @param key - * @return context - */ - public RpcContext removeAttachment(String key) { - attachments.remove(key); - return this; - } + + /** + * set attachment. + * + * @param key + * @param value + * @return context + */ + public RpcContext setAttachment(String key, String value) { + if (value == null) { + attachments.remove(key); + } else { + attachments.put(key, value); + } + return this; + } + + /** + * remove attachment. + * + * @param key + * @return context + */ + public RpcContext removeAttachment(String key) { + attachments.remove(key); + return this; + } /** * get attachments. diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcException.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcException.java index 1ae22950b9..429d924412 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcException.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/RpcException.java @@ -1,18 +1,18 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.rpc; /** @@ -23,6 +23,7 @@ package com.alibaba.dubbo.rpc; * @see com.alibaba.dubbo.rpc.Invoker#invoke(Invocation) * @author shawn.qianx * @author william.liangf + * @export */ public final class RpcException extends RuntimeException { @@ -36,9 +37,9 @@ public final class RpcException extends RuntimeException { public static final int BIZ_EXCEPTION = 3; - public static final int FORBIDDEN_EXCEPTION = 4; - - public static final int SERIALIZATION_EXCEPTION = 5; + public static final int FORBIDDEN_EXCEPTION = 4; + + public static final int SERIALIZATION_EXCEPTION = 5; private int code; // RpcException不能有子类,异常类型用ErrorCode表示,以便保持兼容。 @@ -93,16 +94,16 @@ public final class RpcException extends RuntimeException { public boolean isForbidded() { return code == FORBIDDEN_EXCEPTION; } - - public boolean isTimeout() { - return code == TIMEOUT_EXCEPTION; - } + + public boolean isTimeout() { + return code == TIMEOUT_EXCEPTION; + } public boolean isNetwork() { return code == NETWORK_EXCEPTION; } - - public boolean isSerialization() { - return code == SERIALIZATION_EXCEPTION; - } + + public boolean isSerialization() { + return code == SERIALIZATION_EXCEPTION; + } } \ No newline at end of file diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/EchoService.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/EchoService.java index c09fcd9e90..05dc1bb7db 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/EchoService.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/EchoService.java @@ -1,24 +1,25 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.rpc.service; /** * Echo service. * * @author qian.lei + * @export */ public interface EchoService { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericException.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericException.java index b6c2ebe896..7afa6e9a23 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericException.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericException.java @@ -22,6 +22,7 @@ import com.alibaba.dubbo.common.utils.StringUtils; * * @serial Don't change the class name and properties. * @author william.liangf + * @export */ public class GenericException extends RuntimeException { diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericService.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericService.java index bd621b7c34..f42fbe2b7b 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericService.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/service/GenericService.java @@ -1,24 +1,25 @@ -/* - * 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 - * - * 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. - */ +/* + * 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 + * + * 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.rpc.service; /** * 通用服务接口 * * @author william.liangf + * @export */ public interface GenericService {