Skip to content

Support for Java 8 CompletableFuture<T> as suppliment to Future+CompletionHandler #399

Closed
@tnn

Description

@tnn

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:

asyncHttpClient.prepareGet(url)
    .exceuteJava8Style()
    .thenApply(res -> doStuff(res))
    .exceptionally(e -> log.error("Got exception", e));

[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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions