JDK-8204339 : HTTP Client Dependent tasks should run in the common pool
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-06-05
  • Updated: 2019-09-03
  • Resolved: 2018-06-11
Related Reports
Relates :  
Description
Currently dependent tasks are specified, where practical, to run in the HTTP Client executor. This is not the best idea, since synchronous dependent tasks could block, or cause several other long running tasks, or chains of tasks, to execute. Also, the defaultExecutor of CF's returned is still the same as CompletableFuture.defaultExecutor, which is mostly the common pool. It is a cleaner and easier model to have the HTTP Client set up execution of synchronous dependent tasks in the CF.defaultExecutor, which is more familiar to developers, and easier to understand. This also reduces the likelihood of the HTTP Client being starved of threads to execute its tasks.

This is just default behaviour, both the HTTP Client and CompletableFuture allow more fine-grain control, if needed.
Comments
Fixed in the sandbox: http://hg.openjdk.java.net/jdk/sandbox/rev/f57700f449bd
06-06-2018