Skip to content
Ameen Abozaid
Planned lessonMID-006-L05

Which thread runs my stage?

  • Lesson 5 of 6
  • Mid-level
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-Async methods (thenApply) run on whichever thread completes the previous stage (or the caller if already complete); thenApplyAsync hops 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.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.