You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2020/04/01 15:02:05 UTC

[dubbo] branch master updated: Update ForkingClusterInvoker.java (#5875)

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/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 61d5d44  Update ForkingClusterInvoker.java (#5875)
61d5d44 is described below

commit 61d5d44b90b76f264ecdf5aa50763a91b91e0fa6
Author: August <33...@users.noreply.github.com>
AuthorDate: Wed Apr 1 23:01:52 2020 +0800

    Update ForkingClusterInvoker.java (#5875)
---
 .../org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java
index 7ce7729..53a2c34 100644
--- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java
+++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/support/ForkingClusterInvoker.java
@@ -70,8 +70,8 @@ public class ForkingClusterInvoker<T> extends AbstractClusterInvoker<T> {
             if (forks <= 0 || forks >= invokers.size()) {
                 selected = invokers;
             } else {
-                selected = new ArrayList<>();
-                for (int i = 0; i < forks; i++) {
+                selected = new ArrayList<>(forks);
+                while (selected.size() < forks) {
                     Invoker<T> invoker = select(loadbalance, invocation, invokers, selected);
                     if (!selected.contains(invoker)) {
                         //Avoid add the same invoker several times.