From 780f6ee609dea5b2c60a4a2b0c842cd72dbf4dd8 Mon Sep 17 00:00:00 2001 From: "ken.lj" Date: Fri, 24 May 2019 20:57:34 +0800 Subject: [PATCH] commit follow #4148 --- .../apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java index f40b664e160..ece71497c53 100644 --- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java +++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/DubboInvoker.java @@ -23,7 +23,6 @@ import org.apache.dubbo.remoting.RemotingException; import org.apache.dubbo.remoting.TimeoutException; import org.apache.dubbo.remoting.exchange.ExchangeClient; -import org.apache.dubbo.rpc.AppResponse; import org.apache.dubbo.rpc.AsyncRpcResult; import org.apache.dubbo.rpc.Invocation; import org.apache.dubbo.rpc.Invoker; @@ -97,13 +96,7 @@ protected Result doInvoke(final Invocation invocation) throws Throwable { } else { AsyncRpcResult asyncRpcResult = new AsyncRpcResult(inv); CompletableFuture responseFuture = currentClient.request(inv, timeout); - responseFuture.whenComplete((obj, t) -> { - if (t != null) { - asyncRpcResult.completeExceptionally(t); - } else { - asyncRpcResult.complete((AppResponse) obj); - } - }); + asyncRpcResult.subscribeTo(responseFuture); RpcContext.getContext().setFuture(new FutureAdapter(asyncRpcResult)); return asyncRpcResult; }