Let's say in Java I have a bounded BlockingQueue and I want to process items off that queue with at most N threads. The amount N should be adjustable. The solution should take not more than N items off the queue, such that it preserves its role as providing back pressure. How would I achieve this?
I got a long way with http://jcip.net/listings/BoundedExecutor.java, but that doesn't really allow for resizes.