3. How we handle it .....
Threads
Dedicate separate thread
for producer & consumer
Handle sync'n
Result in a code tedious to extend
A traditional approach
Producer Consumer
<<Runnable>> <<Runnable>>
4. Queue
A data structure
Make use of existing classes in JDK
Let the producer and consumer class rely on the
queue
(Broker)
Queue
Producer Consumer
<<Runnable>> <<Runnable>>