[
https://issues.apache.org/jira/browse/HADOOP-12910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15320839#comment-15320839
]
Tsz Wo Nicholas Sze commented on HADOOP-12910:
----------------------------------------------
> Why the insistence on doing the async twice? Once for branch-2 and then with
> a totally different API in branch-3? ...
No, they are the same API. Branch-2 is a simplified version of trunk.
Features such as chaining are attractive, cool, fashionable and I-like-it,
however, nonessential. Today we don't have any async API so that users cannot
possibly do anything to work around it -- when a blocking call is invoked, the
caller is blocked. Once we have an async API as simple as returning Future.
The caller can possibly use other mean or library to do chaining. Please
correct me if you disagree.
> Why invent an API (based on AWT experience with mouse-moved listeners )
> rather than take on a proven one whose author is trying to help here and
> whose API surface is considerably less than the CompletableFuture
> kitchen-sink?
Honestly, I won't dare to claim that I "invented" the API I proposed. It is
just a well-known approach, also known as the Observer pattern. Let's take a
look of the
[ListenableFuture|https://github.com/google/guava/blob/master/guava/src/com/google/common/util/concurrent/ListenableFuture.java]
interface. It declares a similar method, which is the only new method added
to Future.
{code}
//ListenableFuture
void addListener(Runnable listener, Executor executor);
{code}
With this simple method, ListenableFuture (with other library) is able to
support chaining; see
[ListenableFutureExplained|https://github.com/google/guava/wiki/ListenableFutureExplained].
Yes, you are right that AWT uses this approach for mouse-moved listeners. Is
there anything wrong about it? If I tell that NASA also uses this approach for
rocket launching, would it make you feel better?
Thanks.
> Add new FileSystem API to support asynchronous method calls
> -----------------------------------------------------------
>
> Key: HADOOP-12910
> URL: https://issues.apache.org/jira/browse/HADOOP-12910
> Project: Hadoop Common
> Issue Type: New Feature
> Components: fs
> Reporter: Tsz Wo Nicholas Sze
> Assignee: Xiaobing Zhou
> Attachments: HADOOP-12910-HDFS-9924.000.patch,
> HADOOP-12910-HDFS-9924.001.patch, HADOOP-12910-HDFS-9924.002.patch
>
>
> Add a new API, namely FutureFileSystem (or AsynchronousFileSystem, if it is a
> better name). All the APIs in FutureFileSystem are the same as FileSystem
> except that the return type is wrapped by Future, e.g.
> {code}
> //FileSystem
> public boolean rename(Path src, Path dst) throws IOException;
> //FutureFileSystem
> public Future<Boolean> rename(Path src, Path dst) throws IOException;
> {code}
> Note that FutureFileSystem does not extend FileSystem.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]