code: public void awaitTermination(long timeout, TimeUnit unit) {
          try {
              executorService.awaitTermination(timeout, unit);
          } catch (InterruptedException e) {
              throw new RuntimeException("Job executor was interrupted while waiting");
          }
      }
docs: Wait for jobs to terminate.