Skip to content

Commit

Permalink
Adaptive
Browse files Browse the repository at this point in the history
  • Loading branch information
linruowang committed Sep 6, 2021
1 parent 78e4e32 commit 81f9e6c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
4 changes: 3 additions & 1 deletion dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
consumer://30.5.120.217/org.apache.dubbo.demo.DemoService?application=demo-consumer&category=consumers&check=false&dubbo=2.0.2&interface=org.apache.dubbo.demo.DemoService&methods=sayHello&pid=1209&qos.port=33333&side=consumer&timestamp=1545721827784
描述一个消费者
描述服务调用
dubbo://192.168.175.1:20880/org.apache.dubbo.demo.DemoService?anyhost=true&application=dubbo-demo-annotation-provider&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=org.apache.dubbo.demo.DemoService&methods=sayHello,sayHelloAsync&pid=15012&release=&side=provider&timestamp=1610857629484
Dubbo的Consumer会向Zookeeper传入如下参数进行服务的订阅操作。
consumer://192.168.175.1/org.apache.dubbo.demo.DemoService?application=dubbo-demo-annotation-consumer&category=providers,configurators,routers&dubbo=2.0.2&init=false&interface=org.apache.dubbo.demo.DemoService&methods=sayHello,sayHelloAsync&pid=15184&side=consumer&sticky=false&timestamp=1610860963037
*/

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public com.alibaba.dubbo.rpc.Exporter export(com.alibaba.dubbo.rpc.Invoker arg0)
*
* `@Adaptive` 可添加类或方法上。这两种方式表现不同:
*
* 1. 当在 类 上时,直接使用被注解的类。也因此,一个拓展,只允许最多注解一个类,否则会存在多个会是冲突。
* 1. 当在 类 上时,直接使用被注解的类。也因此,一个拓展,只允许最多注解一个类,否则会存在多个会是冲突。只有 AdaptiveExtensionFactory
* 2. 当在方法上时,使用 {@link ExtensionLoader#createAdaptiveExtensionClass()} 方法,创建自适应( Adaptive )拓展类。
*
* 如上逻辑,处理的入口方法为 {@link ExtensionLoader#getAdaptiveExtensionClass()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@
*/
package com.alibaba.dubbo.registry.integration;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.extension.ExtensionLoader;
Expand All @@ -38,17 +30,20 @@
import com.alibaba.dubbo.registry.RegistryFactory;
import com.alibaba.dubbo.registry.RegistryService;
import com.alibaba.dubbo.registry.support.ProviderConsumerRegTable;
import com.alibaba.dubbo.rpc.Exporter;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.Protocol;
import com.alibaba.dubbo.rpc.ProxyFactory;
import com.alibaba.dubbo.rpc.RpcException;
import com.alibaba.dubbo.rpc.*;
import com.alibaba.dubbo.rpc.cluster.Cluster;
import com.alibaba.dubbo.rpc.cluster.Configurator;
import com.alibaba.dubbo.rpc.protocol.InvokerWrapper;
import static com.alibaba.dubbo.common.Constants.ACCEPT_FOREIGN_IP;
import static com.alibaba.dubbo.common.Constants.QOS_ENABLE;
import static com.alibaba.dubbo.common.Constants.QOS_PORT;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import static com.alibaba.dubbo.common.Constants.*;

/**
* RegistryProtocol
Expand Down Expand Up @@ -100,6 +95,7 @@ public static RegistryProtocol getRegistryProtocol() {
}

// Filter the parameters that do not need to be output in url(Starting with .)
// 过滤url中不需要输出的参数(以.开头)
private static String[] getFilteredKeys(URL url) {
Map<String, String> params = url.getParameters();
if (params != null && !params.isEmpty()) {
Expand Down

0 comments on commit 81f9e6c

Please sign in to comment.