public static void main(String[] args) {
    System.out.println("Starting.");
    System.out.flush();
    final Semaphore sem = new Semaphore(0);
    for (int i = 0; i < 10; i++) {
      System.out.println("Queing proc " + i);
      System.out.flush();
      final int threadNum = i;
      getDefaultPool().execute(new Runnable() {
        public void run() {
          try {
            System.out.println("Starting proc " + threadNum);
            System.out.flush();
            Thread.currentThread().sleep(threadNum + 5000);
            sem.release();
            System.out.println("Finished proc " + threadNum);
            System.out.flush();
          } catch (Exception e) {} // dont care
        }
      });
    }
    try {
      sem.acquire(10);
    } catch (Exception e) {} // dont care
    System.out.println("Quitting.");
    System.exit(0);
  }