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/07 05:16:10 UTC

[GitHub] [dubbo] EarthChen commented on a change in pull request #8699: [3.0] Add preferredProtocol fallback strategy

EarthChen commented on a change in pull request #8699:
URL: https://github.com/apache/dubbo/pull/8699#discussion_r703181785



##########
File path: dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/metadata/ServiceInstanceHostPortCustomizer.java
##########
@@ -56,11 +60,19 @@ public void customize(ServiceInstance serviceInstance) {
                         break;
                     }
                 }
+                
+                if (host == null || port == -1) {
+                    logger.warn("The default preferredProtocol \"" + preferredProtocol + "\" is not found, fall back to the strategy that pick the first found protocol. Please try to modify the config of dubbo.application.protocol");
+                    URL url = urls.iterator().next();
+                    host = url.getHost();
+                    port = url.getPort();
+                }
             } else {
                 URL url = urls.iterator().next();

Review comment:
       Set does not guarantee order




-- 
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