private void waitForAllThreadsToJoin(ExecutorService  processExecutor, List <CommandLineThreadWrapper> pythonCmdThreads, Integer timeout)
    throws SystemException {
    processExecutor.shutdown();
    try {
      processExecutor.awaitTermination(timeout, TimeUnit.MILLISECONDS);
      processExecutor.shutdownNow();
      for (CommandLineThreadWrapper commandLineThreadWrapper: pythonCmdThreads) {
        CommandLineThread commandLineThread = commandLineThreadWrapper.getCommandLineThread();
        try {
          Integer returnCode = commandLineThread.getReturnCode();
          if (returnCode == null) {
            throw new TimeoutException();
          } else if (returnCode != 0) {
            throw new ExecutionException(String.format("Execution of \"%s\" returned %d.", commandLineThreadWrapper.getCommandLine(), returnCode),
              new Throwable(commandLineThreadWrapper.getLogStream().getOutput()));
          }
        } catch (TimeoutException e) {
          LOG.error("Generate client configs script was killed due to timeout ", e);
          throw new SystemException("Generate client configs script was killed due to timeout ", e);
        } catch (ExecutionException e) {
          LOG.error(e.getMessage(), e);
          throw new SystemException(e.getMessage() + " " + e.getCause());
        } finally {
          commandLineThreadWrapper.getProcess().destroy();
        }
      }
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      processExecutor.shutdownNow();
      LOG.error("Failed to run generate client configs script for components");
      throw new SystemException("Failed to run generate client configs script for components");
    }
  }
Waits for all threads to join that have started python process to tar config files for component
@param processExecutor {@link ExecutorService} executes the process when threads are available in the pool
@param pythonCmdThreads list of {@link CommandLineThreadWrapper}
@param timeout {Integer} time to wait for the threads to join
@throws SystemException
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClientConfigResourceProvider.java