NOTE
Executors Factory Methods
Convenience ExecutorService factories, their hidden queue/thread choices, and why explicit executor configuration or virtual-thread executors are often clearer.
This is a historical learning note and may contain outdated or incomplete understanding.
1. Convenience Factories
Executors provides factory methods such as fixed, single-thread, cached, scheduled, work-stealing, and in modern Java virtual-thread-per-task executors.
2. Hidden Policies Matter
Older advice says “never use Executors” because some factories choose effectively unbounded queues or thread counts. The deeper rule is:
understand and intentionally choose the executor’s concurrency and queueing policy.
A fixed thread pool with an unbounded queue can accumulate huge backlog. A cached pool can create many platform threads.
3. Prefer Explicitness for Servers
For latency-sensitive production services, explicit ThreadPoolExecutor configuration often makes capacity/rejection observable and reviewable.
4. Virtual Threads
For blocking task-per-request code, Executors.newVirtualThreadPerTaskExecutor() can simplify concurrency, but downstream limits still require semaphores/pools/rate limits.