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 2021/06/08 08:32:10 UTC

[dubbo] branch master updated: Optimize DubboProtocol code and extract constants (#8004)

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 95e83e9  Optimize DubboProtocol code and extract constants (#8004)
95e83e9 is described below

commit 95e83e9c9cb96aed3ece214528b39e3aa3391188
Author: xiaoheng1 <20...@qq.com>
AuthorDate: Tue Jun 8 16:31:56 2021 +0800

    Optimize DubboProtocol code and extract constants (#8004)
    
    fixes  #8003
---
 .../java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
index 35cd19e..9b6067e 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboProtocol.java
@@ -59,9 +59,11 @@ import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.function.Function;
 
+import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SEPARATOR;
 import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.INTERFACE_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.LAZY_CONNECT_KEY;
+import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.STUB_EVENT_KEY;
 import static org.apache.dubbo.common.constants.CommonConstants.VERSION_KEY;
@@ -121,12 +123,12 @@ public class DubboProtocol extends AbstractProtocol {
             Invoker<?> invoker = getInvoker(channel, inv);
             // need to consider backward-compatibility if it's a callback
             if (Boolean.TRUE.toString().equals(inv.getObjectAttachments().get(IS_CALLBACK_SERVICE_INVOKE))) {
-                String methodsStr = invoker.getUrl().getParameters().get("methods");
+                String methodsStr = invoker.getUrl().getParameters().get(METHODS_KEY);
                 boolean hasMethod = false;
-                if (methodsStr == null || !methodsStr.contains(",")) {
+                if (methodsStr == null || !methodsStr.contains(COMMA_SEPARATOR)) {
                     hasMethod = inv.getMethodName().equals(methodsStr);
                 } else {
-                    String[] methods = methodsStr.split(",");
+                    String[] methods = methodsStr.split(COMMA_SEPARATOR);
                     for (String method : methods) {
                         if (inv.getMethodName().equals(method)) {
                             hasMethod = true;