This lightning talk discusses producer-consumer use cases in Java. It introduces the producer-consumer problem and describes two common approaches: using dedicated producer and consumer threads that synchronize directly, or using a shared queue that acts as a broker between the producer and consumer threads. The talk provides a code example of the queue-based approach and includes a link to a GitHub project implementing this solution. It concludes by inviting questions from the audience.
1 of 8
Download to read offline
More Related Content
Producer consumerproblem
1. (EN)Lightning!!! talk on
Handling
Producer Consumer
use cases in Java
- Prasanna
Twitter @prasonscala
e-mail prassee.sathian at gmail dot com
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>>