You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/10/09 08:03:36 UTC

[dubbo] branch 3.0 updated: [3.0] change local invokers from Collections.singletonList to ArrayList (#8997)

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

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new babd7b1  [3.0] change local invokers from Collections.singletonList to ArrayList (#8997)
babd7b1 is described below

commit babd7b14b446c515519d6bf093e7fb14e3f2fc14
Author: zrlw <zr...@sina.com>
AuthorDate: Sat Oct 9 16:03:27 2021 +0800

    [3.0] change local invokers from Collections.singletonList to ArrayList (#8997)
    
    * change local invokers from Collections.singletonList to ArrayList
    
    * remove useless import
---
 .../src/main/java/org/apache/dubbo/config/ReferenceConfig.java    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
index 5c8639d..47d2c82 100644
--- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
+++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ReferenceConfig.java
@@ -51,7 +51,6 @@ import org.apache.dubbo.rpc.support.ProtocolUtils;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -399,15 +398,16 @@ public class ReferenceConfig<T> extends ReferenceConfigBase<T> {
      *
      * @param referenceParameters
      */
+    @SuppressWarnings({"unchecked", "rawtypes"})
     private void createInvokerForLocal(Map<String, String> referenceParameters) {
         URL url = new ServiceConfigURL(LOCAL_PROTOCOL, LOCALHOST_VALUE, 0, interfaceClass.getName()).addParameters(referenceParameters);
         url = url.setScopeModel(getScopeModel());
         url = url.setServiceModel(consumerModel);
         Invoker<?> withFilter = protocolSPI.refer(interfaceClass, url);
-
         // Local Invoke ( Support Cluster Filter / Filter )
-        StaticDirectory<?> directory = new StaticDirectory<>(url, Collections.singletonList(withFilter));
-        invoker = Cluster.getCluster(url.getScopeModel(), Cluster.DEFAULT).join(directory, true);
+        List<Invoker<?>> invokers = new ArrayList<>();
+        invokers.add(withFilter);
+        invoker = Cluster.getCluster(url.getScopeModel(), Cluster.DEFAULT).join(new StaticDirectory(url, invokers), true);
 
         if (logger.isInfoEnabled()) {
             logger.info("Using in jvm service " + interfaceClass.getName());