Which thread runs my stage?
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
choose executors deliberately.
Planned topics
- Without an executor, async methods use the common
ForkJoinPool, sized for CPU work. - Blocking I/O in the common pool starves everything else that uses it, including parallel streams.
- Pass a dedicated executor for blocking calls:
supplyAsync(task, ioPool). - Non-
Asyncmethods (thenApply) run on whichever thread completes the previous stage (or the caller if already complete);thenApplyAsynchops to a pool. - Never call
join()inside a stage on a pool that may be exhausted.
Draft outline details
Demonstration
a diagram: HTTP calls on an ioPool; light mapping stays on the completing thread.
Check your understanding
Why avoid blocking I/O on the common pool?
Show answer
It is small and shared; blocking starves other work.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.