Skip to content

Make ListenableFuture chainable [SPR-12867] #17465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Mar 31, 2015 · 2 comments
Closed

Make ListenableFuture chainable [SPR-12867] #17465

spring-projects-issues opened this issue Mar 31, 2015 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Mar 31, 2015

Andrei Tuzhilin opened SPR-12867 and commented

In #16440 there was a proposal to add chainable Future callbacks, like google guava ListenableFuture does.

Here is the the code by Sébastien Deleuze.

PS: Why not just use Google guava or Reactor promises for that, instead of adding Yet Another Listenable Future Implementation?


Affects: 4.1.6

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented May 19, 2015

Sébastien Deleuze commented

Thanks for creating this issue, being able to chain non blocking future and transformations is a real need that have to be addressed.

That said, the code you mentioned was mainly an experiment for supporting lambdas with 2 separated methods, the ListenableFuture return type value was the this instance in order to be able to call the failure callback, it was not intended to chain multiple calls. Supporting this in a powerful way is not straightforward, and I fully agree with your proposal to use external well known libraries for that.

For 4.2, the best candidate for that need is CompletableFuture, thanks to #17198 and #16821 you are going to be able to use CompletableFuture as return value in your @RequestMapping and @MessageMapping handler methods. That does not help for AsyncRestTemplate that uses ListenableFuture, but maybe we could provides some helpers here.

For the future, I think an interesting option to consider is RxJava. Currently they are mainly focused on dealing with multiple data with their Observable type, but they are working on supporting a new Single type (see this issue for more details) that would perfectly match the need we are discussing here.

As a consequence, I would be in favor to close this issue as "Won't fix", support a way to convert easily a ListenableFuture to CompletableFuture, and evaluate for upcoming Spring Framework versions what type(s) are interesting to support.

Any thoughts?

@spring-projects-issues
Copy link
Collaborator Author

Sébastien Deleuze commented

As explained in my last comment, I resolve this issue as won't fix but feel free to send us some feedback in order to continue the discussion.

@spring-projects-issues spring-projects-issues added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants