Demo: parallelizing the price-feed import
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
speed up the supplier price import; prepares MID-003-LAB1.
Draft outline details
Step by step
- Show the sequential import of five suppliers (each about 300 ms): about 1.5 s.
- Wrap each import in a
Callable; submit to a fixed pool of 5. - Collect with
Future.get(timeout); gather successes and failures into a report. - Measure again: wall clock near the slowest supplier.
- Planned mistake: forget
shutdown()and watch the app not exit. Fix:shutdownplusawaitTerminationinfinally(or try-with-resources on newer JDKs; verify version before recording). - Print the report: imported, failed, timed out.
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.