This is a follow up to my previous not answered question, so I try to make it more clear: last question.
I have a n-size buffer that is filled up from an external source, it has 2 main methods get() and add(), get() blocks (via wait()) if buffer is empty and add() blocks if buffer is full.
This buffer object reference is available to multiple consumers (threads).
Each consumer reads data from buffer independently from other consumers .
All Consumers must read ALL data from the buffer.
As someone suggested, I have created A hashmap where key is an id of the consumer and value is the index within the buffer that was read by this consumer.
The problem is that every consumer continues to request data from buffer. I need somehow to block it until next dataitem get available for it in buffer.
Where and how should I block it?
(I can't use wait() in consumers object, because the producer can't call notify() since producer and consumer are different objects)