This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new e07038b  Add comments, manually merge #3181.
e07038b is described below

commit e07038b00e057bb3cd6989252534b581039916f9
Author: ken.lj <[email protected]>
AuthorDate: Wed Jan 23 17:32:56 2019 +0800

    Add comments, manually merge #3181.
---
 .../dubbo/registry/integration/RegistryDirectory.java    | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
index 8ec3bcb..449bb28 100644
--- 
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
+++ 
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/integration/RegistryDirectory.java
@@ -228,9 +228,9 @@ public class RegistryDirectory<T> extends 
AbstractDirectory<T> implements Notify
     private void refreshInvoker(List<URL> invokerUrls) {
         Assert.notNull(invokerUrls, "invokerUrls should not be null");
 
-        if (invokerUrls.size() == 1 && invokerUrls.get(0) != null && 
Constants.EMPTY_PROTOCOL.equals(invokerUrls
-                .get(0)
-                .getProtocol())) {
+        if (invokerUrls.size() == 1
+                && invokerUrls.get(0) != null
+                && 
Constants.EMPTY_PROTOCOL.equals(invokerUrls.get(0).getProtocol())) {
             this.forbidden = true; // Forbid to access
             this.invokers = Collections.emptyList();
             routerChain.setInvokers(this.invokers);
@@ -252,8 +252,14 @@ public class RegistryDirectory<T> extends 
AbstractDirectory<T> implements Notify
             }
             Map<String, Invoker<T>> newUrlInvokerMap = 
toInvokers(invokerUrls);// Translate url list to Invoker map
 
-            // state change
-            // If the calculation is wrong, it is not processed.
+            /**
+             * If the calculation is wrong, it is not processed.
+             *
+             * 1. The protocol configured by the client is inconsistent with 
the protocol of the server.
+             *    eg: consumer protocol = dubbo, provider only has other 
protocol services(rest).
+             * 2. The registration center is not robust and pushes illegal 
specification data.
+             *
+             */
             if (CollectionUtils.isEmptyMap(newUrlInvokerMap)) {
                 logger.error(new IllegalStateException("urls to invokers error 
.invokerUrls.size :" + invokerUrls.size() + ", invoker.size :0. urls :" + 
invokerUrls
                         .toString()));

Reply via email to