You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/16 03:01:16 UTC
[GitHub] [dubbo] guohao commented on a change in pull request #8757: [3.0] Fix consumer using URL direct connection can not get ServerContext
guohao commented on a change in pull request #8757:
URL: https://github.com/apache/dubbo/pull/8757#discussion_r709715348
##########
File path: dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
##########
@@ -490,18 +496,22 @@ private void createInvokerForRemote() {
// registry url is available
// for multi-subscription scenario, use 'zone-aware' policy by default
String cluster = registryUrl.getParameter(CLUSTER_KEY, ZoneAwareCluster.NAME);
- // The invoker wrap sequence would be: ZoneAwareClusterInvoker(StaticDirectory) -> FailoverClusterInvoker(RegistryDirectory, routing happens here) -> Invoker
+ // The invoker wrap sequence would be: ZoneAwareClusterInvoker(StaticDirectory) -> FailoverClusterInvoker
+ // (RegistryDirectory, routing happens here) -> Invoker
invoker = Cluster.getCluster(registryUrl.getScopeModel(), cluster, false).join(new StaticDirectory(registryUrl, invokers));
} else {
// not a registry url, must be direct invoke.
- String cluster = CollectionUtils.isNotEmpty(invokers) ?
- (invokers.get(0).getUrl() != null ? invokers.get(0).getUrl().getParameter(CLUSTER_KEY, ZoneAwareCluster.NAME) :
- Cluster.DEFAULT)
- : Cluster.DEFAULT;
- ScopeModel scopeModel = CollectionUtils.isNotEmpty(invokers) ?
- (invokers.get(0).getUrl() != null ? invokers.get(0).getUrl().getScopeModel() : null)
- : null;
- invoker = Cluster.getCluster(scopeModel, cluster).join(new StaticDirectory(invokers));
+ if (CollectionUtils.isEmpty(invokers)) {
+ throw new IllegalArgumentException("invokers == null");
+ }
+ URL curUrl = invokers.get(0).getUrl();
+ String cluster = curUrl.getParameter(CLUSTER_KEY, Cluster.DEFAULT);
+ // ?
+ // (invokers.get(0).getUrl() != null ? invokers.get(0).getUrl().getParameter(CLUSTER_KEY,
Review comment:
Remove unused code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org