Creating a NotifyingBlockingThreadPoolExecutor: a thread pool that works on several tasks in parallel but waits to add new tasks until a free thread was there to handle them. A solution is also discussed in Java Concurrency in Practice by Brian Goetz et al.