User Tools

Site Tools


java:futures

This is an old revision of the document!


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.
java/futures.1782153634.txt.gz · Last modified: by carl