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
Support for Java 8 CompletableFuture<T> as suppliment to Future+CompletionHandler #399
Comments
As you said, there's the point of compatibility, and we can't target JDK 8 for the standard AHC API. Note that you can register listeners on the |
I ended up here after researching a clean way to batch requests and only continue once they all return. The java 8 way appears to be |
@ixtli Quite easy to implement yourself with some listeners on the |
Sweet! I'll look into it :) |
What about using a
That's the alternative that I found ... not sure if it's the best, what do you think? |
Yep, that's the way to do it until we target JDK8 (which won't sadly happen in a near future). |
|
JDK 8 introduces a composable standard Future called CompletableFuture[1]. Even through it will be a pain to support this while retaining backwards compatibility, adding support for this standard future is very important when designing complete async systems. It enables the same returned Future to be reused, composed[2] and simplifies the usage of AsyncHttpClient.
Example usage:
[1] http://download.java.net/jdk8/docs/api/java/util/concurrent/CompletableFuture.html
[2] http://nurkiewicz.blogspot.dk/2013/05/java-8-completablefuture-in-action.html
The text was updated successfully, but these errors were encountered: