// If override url has port, means it is a provider address. We want to control a specific provider with this override url, it may take effect on the specific provider instance or on consumers holding this provider instance.
// 配置规则,URL 带有端口( port ),意图是控制提供者机器。可以在提供端生效 也可以在消费端生效
if(configuratorUrl.getPort()!=0){
if(url.getPort()==configuratorUrl.getPort()){
returnconfigureIfMatch(url.getHost(),url);
}
}else{// override url don't have a port, means the ip override url specify is a consumer address or 0.0.0.0
// override url don't have a port, means the ip override url specify is a consumer address or 0.0.0.0
// 配置规则,URL 没有端口,override 输入消费端地址 或者 0.0.0.0
}else{
// 1.If it is a consumer ip address, the intention is to control a specific consumer instance, it must takes effect at the consumer side, any provider received this override url should ignore;
// 2.If the ip is 0.0.0.0, this override url can be used on consumer, and also can be used on provider
returnconfigureIfMatch(Constants.ANYHOST_VALUE,url);// take effect on all providers, so address must be 0.0.0.0, otherwise it won't flow to this if branch
}
}
...
...
@@ -71,34 +79,41 @@ public abstract class AbstractConfigurator implements Configurator {