This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.0-multi-instances
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0-multi-instances by this
push:
new 99d4b41 Fix ut
99d4b41 is described below
commit 99d4b410fac5175384933540347fbc892ab99404
Author: Albumen Kevin <[email protected]>
AuthorDate: Mon Aug 30 17:36:39 2021 +0800
Fix ut
---
.../java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java
b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java
index 1e658b6..d6d2ddd 100644
---
a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java
+++
b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/RestProtocol.java
@@ -23,6 +23,7 @@ import
org.apache.dubbo.remoting.http.servlet.BootstrapListener;
import org.apache.dubbo.remoting.http.servlet.ServletManager;
import org.apache.dubbo.rpc.ProtocolServer;
import org.apache.dubbo.rpc.RpcException;
+import org.apache.dubbo.rpc.model.ApplicationModel;
import org.apache.dubbo.rpc.protocol.AbstractProxyProtocol;
import org.apache.http.HeaderElement;
@@ -93,7 +94,12 @@ public class RestProtocol extends AbstractProxyProtocol {
@Override
protected <T> Runnable doExport(T impl, Class<T> type, URL url) throws
RpcException {
String addr = getAddr(url);
- Class implClass = url.getServiceModel().getProxyObject().getClass();
+ Class implClass;
+ if (url.getScopeModel() != null) {
+ implClass = url.getServiceModel().getProxyObject().getClass();
+ } else {
+ implClass =
ApplicationModel.getProviderModel(url.getServiceKey()).getServiceInstance().getClass();
+ }
RestProtocolServer server = (RestProtocolServer)
serverMap.computeIfAbsent(addr, restServer -> {
RestProtocolServer s =
serverFactory.createServer(url.getParameter(SERVER_KEY, DEFAULT_SERVER));
s.setAddress(url.getAddress());