code: public void shutdownAndWaitUntilDone()
      {
          shutdown();
          while(true)
          {
              synchronized (endSignal)
              {
                  try
                  {
                      if ((combinedState.get() & 0x7FFFFFFFFFFFFFFFL) == 0) break;
                      endSignal.wait(100);
                  }
                  catch (InterruptedException e)
                  {
                      // ignore
                  }
              }
          }
      }
docs: Shuts down the executor and blocks until all tasks have completed execution