Java ExecutorService with a blocking queue(programtak.com)
programtak.com
Java ExecutorService with a blocking queue
http://www.programtak.com/2015/12/create-fixed-length-queue-for-threads.html
1 comments
When would you want to block as you insert tasks into an ExecutorService already executing N concurrent tasks? Why not use "newFixedThreadPool" and don't block but stil keep a maximum of N concurrent tasks? Honest question, not snarky.
This can be used when you have limited resources like cpus and you want only a limited set of resource intensive tasks executing at any particular point of time..