[
https://issues.apache.org/jira/browse/HADOOP-12910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15317847#comment-15317847
]
Benoit Sigoure commented on HADOOP-12910:
-----------------------------------------
One of the key things that {{Deferred}} and [Finagle's
{{Future}}|https://twitter.github.io/finagle/guide/Futures.html#sequential-composition]
both enable is composition. This allows you to chain multiple asynchronous
operations in a type-safe fashion.
For example, when making an RPC call to HBase, a client might first need to do
a lookup in ZooKeeper, which asynchronously returns a byte array, then parse a
RegionInfo out of the byte array and make an RPC call to an HBase server, which
returns some response of type {{FooResponse}}. In this semi-hypothetical
pipeline, {{Deferred}} and {{Future}} allow you to build a string of
asynchronous operations, in which the (successful) output of one operation is
the input of the next operation. I don't see how the proposed
{{FutureWithCallback}} interface can cater to such use cases, which will lead
to asynchronous APIs that are difficult to compose.
In the proposal for trunk at least with {{CompletionStage}} you get that with
{{thenApply}}, but I hope this means that not too many APIs will be created
with {{FutureWithCallback}}, as they'll probably stick around for a while and
be hard to get rid of.
> 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]