From f5b6d2aa94591ef446a4c81b438fb501d5feaa8e Mon Sep 17 00:00:00 2001 From: huazhongming Date: Mon, 28 Jan 2019 17:44:00 +0800 Subject: [PATCH] delete useless judgment (#3326) --- .../dubbo/rpc/protocol/injvm/InjvmProtocol.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java b/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java index e6959d4bd1c..1181e899d71 100644 --- a/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java +++ b/dubbo-rpc/dubbo-rpc-injvm/src/main/java/org/apache/dubbo/rpc/protocol/injvm/InjvmProtocol.java @@ -93,27 +93,23 @@ public Invoker refer(Class serviceType, URL url) throws RpcException { } public boolean isInjvmRefer(URL url) { - final boolean isJvmRefer; String scope = url.getParameter(Constants.SCOPE_KEY); // Since injvm protocol is configured explicitly, we don't need to set any extra flag, use normal refer process. - if (Constants.LOCAL_PROTOCOL.toString().equals(url.getProtocol())) { - isJvmRefer = false; - } else if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter(Constants.LOCAL_PROTOCOL, false))) { + if (Constants.SCOPE_LOCAL.equals(scope) || (url.getParameter(Constants.LOCAL_PROTOCOL, false))) { // if it's declared as local reference // 'scope=local' is equivalent to 'injvm=true', injvm will be deprecated in the future release - isJvmRefer = true; + return true; } else if (Constants.SCOPE_REMOTE.equals(scope)) { // it's declared as remote reference - isJvmRefer = false; + return false; } else if (url.getParameter(Constants.GENERIC_KEY, false)) { // generic invocation is not local reference - isJvmRefer = false; + return false; } else if (getExporter(exporterMap, url) != null) { // by default, go through local reference if there's the service exposed locally - isJvmRefer = true; + return true; } else { - isJvmRefer = false; + return false; } - return isJvmRefer; } }