public static <T> Collection<SyncThread<T>> getCompletedThreads(int num,
      Callable<T> callable) throws InterruptedException {
    Collection<SyncThread<T>> rv = new ArrayList<SyncThread<T>>(num);

    CyclicBarrier barrier = new CyclicBarrier(num);
    for (int i = 0; i < num; i++) {
      rv.add(new SyncThread<T>(barrier, callable));
    }

    for (SyncThread<T> t : rv) {
      t.join();
    }

    return rv;
  }
Get a collection of SyncThreads that all began as close to the same time as
possible and have all completed.

@param <T> the result type of the SyncThread
@param num the number of concurrent threads to execute
@param callable the thing to call
@return the completed SyncThreads
@throws InterruptedException if we're interrupted during join
src/main/java/net/spy/memcached/compat/SyncThread.java