code: public void await(Object taskGroupId) {
          CountDownLatch latch = taskKeyToLatch.get(taskGroupId);
          if (latch == null)
              throw new IllegalArgumentException(
                  "Unknown task group: " + taskGroupId);
          try {
              while(!latch.await(5, TimeUnit.SECONDS))
                  ;
              // Once finished, remove the key so it can be associated with a new
              // task
              taskKeyToLatch.remove(taskGroupId);
          }
          catch (InterruptedException ie) {
              throw new IllegalStateException("Not all tasks finished", ie);
          }
      }
docs: Waits until all the tasks associated with the group identifier have
  finished.  Once a task group has been successfully waited upon, the group
  identifier is removed from the queue and is valid to be reused for a new
  task group.
  
  @throws IllegalArgumentException if the {@code taskGroupId} is not
  currently associated with any active taskGroup