You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Till Rohrmann (JIRA)" <ji...@apache.org> on 2016/08/29 16:45:20 UTC

[jira] [Commented] (FLINK-4361) Replace Scala Futures

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

Till Rohrmann commented on FLINK-4361:
--------------------------------------

I'm not sure whether it's worth the effort to actually develop our own futures even if they have a very limited set of operations. There exist many implementations which exactly do what we're looking for, namely {{CompletableFuture}} (Java 8), {{Future}}/{{Promise}} (Scala) and {{ListenableFuture}} (Guava). 

Ideally, we would be using Java's {{CompletableFuture}} which offers the full set of functionality. However, it is only available in Java 8. Thus as long as we don't ditch Java 7, we cannot use Java's {{CompletableFuture}}.

An alternative would be Guava's {{ListenableFuture}} which offers a similar set of operations. However, we try to get rid of the Guava dependency in Flink. Thus, using the {{ListenableFuture}} would be counter-productive for this effort.

Last but not least, there is Scala's {{Future}} implementation. We're currently using it in the RPC abstraction and at various other places in the code. With the current Flip-6 effort, we try to get rid of Flink's Scala dependency in flink-runtime in the long run. That is the actual reason to replace Scala's {{Futures}}.  However, it is not yet clear when this is going to happen.

Since the current {{RpcService}} implementation relies on {{Akka}}, I think that it's not imminent that we will remove Scala completely from flink-runtime. Therefore, we might still use it to some extent. But in order to make the transition easier, we could define a slimmed down future interface (maybe following the {{CompletableFuture's}} API) which is backed by Scala's {{Futures}}. That way, we wouldn't reinvent the wheel and we could smoothly transition to {{CompletableFuture}} once we ditch Java 7.

As a first set of operations, we would need
- get/await result
- onSuccess/onFailure/onComplete
- transform

Ideally the callbacks would be handled by an {{Executor}} implementation as it is the case for {{CompletableFuture}}.

> Replace Scala Futures
> ---------------------
>
>                 Key: FLINK-4361
>                 URL: https://issues.apache.org/jira/browse/FLINK-4361
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Distributed Coordination
>            Reporter: Stephan Ewen
>
> In order to keep the abstraction Scala Independent, we should not rely on Scala Futures



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)