title: Wait for any task to finish, then start a new one
body: <p>I'm wondering how could I, without doing my own implementation of reporting using blocking queues and similar, as easily as possible implement the following scenario:</p>
  
  <p>I have K * N tasks, every batch of N tasks is a bit different.</p>
  
  <ol>
  <li>Submit the first batch of N tasks (the work is done concurrently on every task)</li>
  <li>When any of the tasks finishes submit a new one (taking it from the second batch)</li>
  </ol>
  
  <p>The second point is repeated until all of the tasks are finished.</p>
  
  <p>Should I use a CyclicBarrier and submit a task when there's one thread waiting? I guess I'd have to use a blocking queue to guarantee that I won't submit the same task twice.</p>