You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/07/01 03:36:42 UTC
[GitHub] [dubbo] AlbumenJ commented on a diff in pull request #10248: [2.7] Fix async call issues
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org