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