Demo: a bounded producer-consumer order pipeline
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
- Create an
ArrayBlockingQueue<OrderEvent>(50)and a producer emitting events quickly. - Start 3 consumers on a fixed pool that "process" each event in 50 ms.
- Log queue size and producer wait time; show the producer slowing down once the queue fills.
- Planned mistake: swap in an unbounded
LinkedBlockingQueueand watch the queue and heap grow without limit. Fix: restore a bound. - 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.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.