I have a blocking queue where multiple writers are writing. I want to put a transaction control mechanism where not more than, say, 50 writers(or near) can write per second. Is there a way I can achieve it?
Edit 1: There is a similar requirement to be done with SocketChannel write method. That is to allow n writers to write per second. The value of n varies. I need not worry about that.
Another Edit: I'm thinking of using a Cyclic Barrier which I will release & reset every second. Am I going the right direction?
Finally I mixed two solution to achieve what I wanted. I used bounded semaphores to limit the writers at any point of time along with timed cyclic barrier which helped me define the total writes/second.