I have wrote following code:
System.out.println(\"Main thread:\" + Thread.currentThread().getId());
CompletableFuture future = CompletableFut
The javadoc for runAsync()
says:
Returns a new CompletableFuture that is asynchronously completed by a task running in the ForkJoinPool.commonPool() after it runs the given action.
There is another version of runAsync()
where you can pass an ExecutorService.
Thus: when the default commonPool() doesn't do what you want - then create your own ExecutorService instead.