[ 
https://issues.apache.org/jira/browse/HBASE-21828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16758933#comment-16758933
 ] 

Duo Zhang commented on HBASE-21828:
-----------------------------------

Oh, what is the jdk version?

And could you please try this code snippet?
{code}
    CompletableFuture<Integer> future = new CompletableFuture<>();
    CompletableFuture<Integer> f1 = future.thenApply(Function.identity());
    CompletableFuture<Integer> f2 = future.thenApply(Function.identity());
    future.whenComplete((r, e) -> System.out.println("error for future " + 
e.toString()));
    f1.whenComplete((r, e) -> System.out.println("error for f1 " + 
e.toString()));
    f2.whenComplete((r, e) -> System.out.println("error for f2 " + 
e.toString()));
    future.completeExceptionally(new Exception("error!"));
{code}

For me, the output is
{noformat}
error for future java.lang.Exception: error!
error for f2 java.util.concurrent.CompletionException: java.lang.Exception: 
error!
error for f1 java.util.concurrent.CompletionException: java.lang.Exception: 
error!
{noformat}

You can see that the whenComplete callback registered on f1 and f2 will get a 
CompletionException instead of the original Exception. My jdk version is oracle 
jdk 1.8.0_181.


> Make sure we do not return CompletionException when locating region
> -------------------------------------------------------------------
>
>                 Key: HBASE-21828
>                 URL: https://issues.apache.org/jira/browse/HBASE-21828
>             Project: HBase
>          Issue Type: Sub-task
>          Components: asyncclient, Client
>            Reporter: Duo Zhang
>            Assignee: Duo Zhang
>            Priority: Major
>             Fix For: 3.0.0, 2.2.0, 2.1.3, 2.0.5, 2.3.0
>
>         Attachments: HBASE-21828.patch
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to