RunnablePermalink

Represents a task to run on a thread. It is a functional interface with one void run() method. Can be run with Thread class or ExecutorService.

CallablePermalink

Kinda the successor of Runnable. It is an interface with V call() method. Can be run with ExecutorService. The return value of the call method can be retrieved with Future<V>.

FuturePermalink

https://www.baeldung.com/java-future Represents a result of an asynchronous computation. This is around since Java 1.5 and is the old way to do async programming in Java. It has some limitations compared to the CompletableFuture.

Interrupting a FuturePermalink

A great advantage is still that when calling future.cancel(true) the underlying thread to compute the result will be interrupted.

CompletableFuturePermalink

https://www.baeldung.com/java-completablefuture This came with Java 8 and is the common way to do async programming in Java. You can chain multiple operations and handle exceptions in a more readable way than with the old Future interface.

Interrupting a CompletableFuturePermalink

When you call completableFuture.cancel(true) the thread(s) computing the results will not be interrupted. But the CompletableFuture itself will be cancelled. https://stackoverflow.com/questions/29013831/how-to-interrupt-underlying-execution-of-completablefuture

Updated: