public void shutdownIdleProcesses() {
    List<ExternalJavacProcessHandler> idleProcesses = null;
    synchronized (myRunningProcesses) {
      for (ExternalJavacProcessHandler process : myRunningProcesses.values()) {
        final long idle = process.getIdleTime();
        if (idle > myKeepAliveTimeout) {
          if (idleProcesses == null) {
            idleProcesses = new ArrayList<>();
          }
          idleProcesses.add(process);
        }
      }
    }
    if (idleProcesses != null) {
      for (ExternalJavacProcessHandler process : idleProcesses) {
        shutdownProcess(process);
      }
    }
  }
public void shutdownIdleProcesses()