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 2023/01/09 03:24:43 UTC

[GitHub] [dubbo] guohao commented on a diff in pull request #11248: Fix invokers has changed when router chain switch

guohao commented on code in PR #11248:
URL: https://github.com/apache/dubbo/pull/11248#discussion_r1064261613


##########
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/directory/AbstractDirectory.java:
##########
@@ -185,28 +186,37 @@ public List<Invoker<T>> list(Invocation invocation) throws RpcException {
             throw new RpcException("Directory of type " + this.getClass().getSimpleName() +  " already destroyed for service " + getConsumerUrl().getServiceKey() + " from registry " + getUrl());
         }
 
-        BitList<Invoker<T>> availableInvokers;
-        // use clone to avoid being modified at doList().
-        if (invokersInitialized) {
-            availableInvokers = validInvokers.clone();
-        } else {
-            availableInvokers = invokers.clone();
-        }
+        try {
+            if (routerChain != null) {
+                routerChain.getLock().readLock().lock();

Review Comment:
   This may cause long-timed wait during calling if a slow `write` occurres



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