Reputation: 3641
I want to have a producer thread that would fetch from a web server new jobs. These should be stored at a local storage as queue or in memory . Then there should be a consumer thread that would read from queue and send these data over rs232 serial. Only one consumer per serial interface as it doesnt make sense otherwise. The problem is how can consumer thread be notified while it is communicating with rs232 ?
Upvotes: 1
Views: 175
Reputation: 41188
Look at the concurrent package.
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/package-summary.html
One of the collections in there will most likely meet your needs.
The consumer threads just pull data off the queue as they are ready to process it.
Upvotes: 1