title: Waiting for a subset of threads in a Java ThreadPool
body: <p>Let's say I have a thread pool containing <code>X</code> items, and a given task employs <code>Y</code> of these items (where <code>Y</code> is much smaller than <code>X</code>).</p>
  
  <p>I want to wait for all of the threads of a given task (<code>Y</code> items) to finish, not the entire thread pool.</p>
  
  <p>If the thread pool's <code>execute()</code> method returned a reference to the employed thread I could simply <code>join()</code> to each of these <code>Y</code> threads, but it doesn't.</p>
  
  <p>Does anyone know of an elegant way to accomplish this? Thanks.</p>