Skip to content
Ameen Abozaid
Planned lessonMID-005-L05

Demo: a bounded producer-consumer order pipeline

  • Lesson 5 of 5
  • Mid-level
On This Lesson 3 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

build the order event buffer; prepares MID-005-LAB1.

Draft outline details

Step by step

  1. Create an ArrayBlockingQueue<OrderEvent>(50) and a producer emitting events quickly.
  2. Start 3 consumers on a fixed pool that "process" each event in 50 ms.
  3. Log queue size and producer wait time; show the producer slowing down once the queue fills.
  4. Planned mistake: swap in an unbounded LinkedBlockingQueue and watch the queue and heap grow without limit. Fix: restore a bound.
  5. Add a poison pill per consumer for clean shutdown; verify produced equals consumed.

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.

Type to search levels, phases, modules and lessons.