JDK-8213114 : Java API doc needs update to specify that explicit usage of commonPool() for CompletableFuture may replace it
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 8,11,12
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2018-10-27
  • Updated: 2025-06-18
  • Resolved: 2025-06-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Description
A DESCRIPTION OF THE PROBLEM :
The documentation for `CompletableFuture` (https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) only states:
> All async methods without an explicit Executor argument are performed using the ForkJoinPool.commonPool() (unless it does not support a parallelism level of at least two, in which case, a new Thread is created to run each task).

However what it does not mention is that when using the commonPool() as explicit executor, it may be replaced as well, see http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/file/b5c6ff776bee/src/share/classes/java/util/concurrent/CompletableFuture.java#l412

Example:
CompletableFuture.runAsync(
      () -> System.out.println(Thread.currentThread().getName()),
      ForkJoinPool.commonPool()
);



Comments
This is no longer applicable since https://bugs.openjdk.org/browse/JDK-8350493, which eliminated need for ThreadPerTask backups
18-06-2025

Affected Java API doc URL's : JDK 8 - https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html JDK 12-ea - https://download.java.net/java/early_access/jdk12/docs/api/java.base/java/util/concurrent/CompletableFuture.html
30-10-2018