You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/05/24 15:50:53 UTC

[dubbo] branch master updated: bugfix follow #4127 (#4155)

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new c14605e  bugfix follow #4127 (#4155)
c14605e is described below

commit c14605e15600e6817e12db07826ca896420f65d3
Author: cvictory <sh...@gmail.com>
AuthorDate: Fri May 24 23:50:47 2019 +0800

    bugfix follow #4127 (#4155)
---
 .../src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java     | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java
index fc26247..658797d 100644
--- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java
@@ -143,6 +143,16 @@ public class AsyncRpcResult extends AbstractResult {
         return this;
     }
 
+    public void subscribeTo(CompletableFuture<?> future) {
+        future.whenComplete((obj, t) -> {
+            if (t != null) {
+                this.completeExceptionally(t);
+            } else {
+                this.complete((Result) obj);
+            }
+        });
+    }
+
     @Override
     public Map<String, String> getAttachments() {
         return getAppResponse().getAttachments();