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()
);
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()
);
- duplicates
-
JDK-8350493 Improve performance of delayed task handling
-
- Closed
-