====== Futures ====== Java has 2 main Future implementations: CompletableFuture and FutureTask. They both implement the [[https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/Future.html|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|Futures]]