private ExternalJavacProcessHandler findRunningProcess(int processHash) {
    debug(()-> "findRunningProcess: looking for hash " + processHash);
    List<ExternalJavacProcessHandler> idleProcesses = null;
    try {
      synchronized (myRunningProcesses) {
        for (Map.Entry<UUID, ExternalJavacProcessHandler> entry : myRunningProcesses.entrySet()) {
          final ExternalJavacProcessHandler process = entry.getValue();
          if (!process.isKeepProcessAlive()) {
            //we shouldn't try to reuse process which will stop after finishing the current compilation
            continue;
          }

          final Integer hash = PROCESS_HASH.get(process);
          if (hash != null && hash == processHash && process.lock()) {
            debug(()-> "findRunningProcess: returning process " + process.getProcessId() + " for hash " + processHash);
            return process;
          }
          if (process.getIdleTime() > myKeepAliveTimeout) {
            if (idleProcesses == null) {
              idleProcesses = new ArrayList<>();
            }
            debug(()-> "findRunningProcess: adding " + process.getProcessId() + " to idle list");
            idleProcesses.add(process);
          }
        }
      }
      debug(()-> "findRunningProcess: no running process for " + processHash + " is found");
      return null;
    }
    finally {
      if (idleProcesses != null) {
        for (ExternalJavacProcessHandler process : idleProcesses) {
          shutdownProcess(process);
        }
      }
    }
  }
private ExternalJavacProcessHandler findRunningProcess(int processHash)