You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2024/06/14 19:57:00 UTC

[jira] [Commented] (HDFS-17543) [ARR] AsyncUtil makes asynchronous code more concise and easier.

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

ASF GitHub Bot commented on HDFS-17543:
---------------------------------------

sjlee commented on PR #6868:
URL: https://github.com/apache/hadoop/pull/6868#issuecomment-2168670824

   Thanks for the contribution, @KeeProMise. One question: is there a reason this should be in hdfs as opposed to hadoop common? This feels like a generic utility that is not specific to hdfs.




> [ARR] AsyncUtil makes asynchronous code more concise and easier.
> ----------------------------------------------------------------
>
>                 Key: HDFS-17543
>                 URL: https://issues.apache.org/jira/browse/HDFS-17543
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Jian Zhang
>            Assignee: Jian Zhang
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HDFS-17543.001.patch
>
>
> *Describe*
> Using the original Java CompletableFuture to implement an asynchronous router is not conducive to the development of the open source community due to poor code readability and maintainability. Therefore, I have implemented a lightweight tool that encapsulates CompletableFuture.
> By using this AsyncUtil, it is easy to write readable asynchronous code, which is easy for everyone to understand. I have provided an example of this tool class in UT, demonstrating how to change synchronous methods to asynchronous code.
>  
> *Examples and tests*
> SyncClass provides some common synchronization methods
> AsyncClass is the corresponding asynchronous implementation
> Use TestAsyncUtil to simultaneously test the methods corresponding to SyncClass and AsyncClass, ensuring that both asynchronous and synchronous methods return the same results
>  
> {*}NOTE{*}: In HDFS-17545, I used this tool to implement RouterAsyncRpcClient which extends RouterRpcClient.  You can also view RouterAsyncRpcClient to understand the use of this tool.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org