AlbumenJ commented on code in PR #10248:
URL: https://github.com/apache/dubbo/pull/10248#discussion_r911589226
##########
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcContext.java:
##########
@@ -732,7 +732,11 @@ public <T> CompletableFuture<T> asyncCall(Callable<T>
callable) {
if (o instanceof CompletableFuture) {
return (CompletableFuture<T>) o;
}
- return CompletableFuture.completedFuture(o);
+ // not only local invoke will return directly, when return
type of method is primitive type,
+ // the proxy will convert null to default value of
primitive type. therefore, should not return a completed Future when protocol
is not injvm
+ if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) {
+ return CompletableFuture.completedFuture(o);
+ }
Review Comment:
If use async call invoke a local service without remote call, this will
break the result
##########
dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/RpcContext.java:
##########
@@ -732,7 +732,11 @@ public <T> CompletableFuture<T> asyncCall(Callable<T>
callable) {
if (o instanceof CompletableFuture) {
return (CompletableFuture<T>) o;
}
- return CompletableFuture.completedFuture(o);
+ // not only local invoke will return directly, when return
type of method is primitive type,
+ // the proxy will convert null to default value of
primitive type. therefore, should not return a completed Future when protocol
is not injvm
+ if (Constants.LOCAL_PROTOCOL.equals(url.getProtocol())) {
Review Comment:
url here might not reliable
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]