[ https://issues.apache.org/jira/browse/HDFS-17552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17867293#comment-17867293 ]
ASF GitHub Bot commented on HDFS-17552: --------------------------------------- szetszwo commented on code in PR #6888: URL: https://github.com/apache/hadoop/pull/6888#discussion_r1684232744 ########## hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java: ########## @@ -96,6 +96,8 @@ public class Client implements AutoCloseable { private static final ThreadLocal<Integer> retryCount = new ThreadLocal<Integer>(); private static final ThreadLocal<Object> EXTERNAL_CALL_HANDLER = new ThreadLocal<>(); + public static final ThreadLocal<CompletableFuture<Object>> CALL_FUTURE_THREAD_LOCAL + = new ThreadLocal<>(); private static final ThreadLocal<AsyncGet<? extends Writable, IOException>> ASYNC_RPC_RESPONSE = new ThreadLocal<>(); Review Comment: There is already a field `ASYNC_RPC_RESPONSE`. Please replace it with `CompletableFuture` instead of adding a new field. > [ARR] IPC client uses CompletableFuture to support asynchronous operations. > --------------------------------------------------------------------------- > > Key: HDFS-17552 > URL: https://issues.apache.org/jira/browse/HDFS-17552 > Project: Hadoop HDFS > Issue Type: Sub-task > Reporter: Jian Zhang > Assignee: Jian Zhang > Priority: Major > Labels: pull-request-available > Attachments: HDFS-17552.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: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org