You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/08/02 10:16:00 UTC
[jira] [Commented] (HADOOP-19235) IPC client uses CompletableFuture to support asynchronous operations.
[ https://issues.apache.org/jira/browse/HADOOP-19235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17870449#comment-17870449 ]
ASF GitHub Bot commented on HADOOP-19235:
-----------------------------------------
steveloughran commented on code in PR #6888:
URL: https://github.com/apache/hadoop/pull/6888#discussion_r1701647551
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java:
##########
@@ -110,7 +110,46 @@ protected Boolean initialValue() {
@Unstable
public static <T extends Writable> AsyncGet<T, IOException>
getAsyncRpcResponse() {
- return (AsyncGet<T, IOException>) ASYNC_RPC_RESPONSE.get();
+ CompletableFuture<Writable> responseFuture = ASYNC_RPC_RESPONSE.get();
Review Comment:
org.apache.hadoop.util.functional.FutureIO should have what you need here already, with `raiseInnerCause` designed to expand that excution exception in a lot more detail.
* I'd propose a followup to switch to it
* and if there is something missing which is broadl useful: add it
> IPC client uses CompletableFuture to support asynchronous operations.
> ---------------------------------------------------------------------
>
> Key: HADOOP-19235
> URL: https://issues.apache.org/jira/browse/HADOOP-19235
> Project: Hadoop Common
> Issue Type: New Feature
> Components: common
> Reporter: Jian Zhang
> Assignee: Jian Zhang
> Priority: Major
> Labels: pull-request-available
> Fix For: HDFS-17531
>
> Attachments: HADOOP-19235.patch
>
>
> h3. Description
> In the implementation of asynchronous Ipc.client, the main methods used include HADOOP-13226, HDFS-10224, etc.
> However, the existing implementation does not support `CompletableFuture`; instead, it relies on setting up callbacks, which can lead to the "callback hell" problem. Using `CompletableFuture` can better organize asynchronous callbacks. Therefore, on the basis of the existing implementation, by using `CompletableFuture`, once the `client.call` is completed, the asynchronous thread handles the response of this call without blocking the main thread.
>
> *Test*
> new UT TestAsyncIPC#testAsyncCallWithCompletableFuture()
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org