These are two different things, ForkJoinTask is a task that can be sent to ForkJoinPool , CompletableFuture is a promise that can work with any Executor , and the executor should not be ForkJoinPool .
True, a generic ForkJoinPool is the default unless you specify it, for example:
CompletableFuture.supplyAsync(()-> supplier);
uses ForkJoinPool if you do not pass Executor . There is another overload that accepts Executor .
CompletableFuture.supplyAsync(()-> supplier,executor);
Async , which is the static class in CompletableFuture extends ForkJoinTask<Void> , but it should not be ForkJoinTask , from Async docs
/ ** Base class can act like FJ or regular Runnable * /
abstract static class Async extends ForkJoinTask<Void> implements Runnable, AsynchronousCompletionTask
It can also be Runnable and a AsynchronousCompletionTask
Only on the side of the note: ForkJoinTask , ForkJoinPool , ForkJoin... classes were added in 1.7, not 1.8
source share