User Tools

Site Tools


java:futures

Futures

Java has 2 main Future implementations: CompletableFuture and FutureTask. They both implement the Future interface. Additionally ForkJoinTask implements Future but this is less managable.

CompletableFuture

CompletableFuture is a full featured Future implementation, capable of chaining and joining. However, its main weakness is that cancellation doesn't stop the underlying computation, and interruption is not supported.

Pain Points

  • The exception passed to exceptionally() and handle() is not well defined. It sometimes is a CompletionException.

See Also: Futures

java/futures.txt · Last modified: by carl