private void cancelPreloadedBuilds(@NotNull String projectPath) {
    if (LOG.isDebugEnabled()) {
      LOG.debug("Cancel preloaded build for " + projectPath + "\n" + getThreadTrace(Thread.currentThread(), 50));
    }
    runCommand(() -> {
      Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler> pair = takePreloadedProcess(projectPath);
      if (pair == null) {
        return;
      }

      final RequestFuture<PreloadedProcessMessageHandler> future = pair.first;
      final OSProcessHandler processHandler = pair.second;
      myMessageDispatcher.cancelSession(future.getRequestID());
      // waiting for the preloaded process from project's task queue guarantees no build is started for this project
      // until this one gracefully exits and closes all its storages
      getProjectData(projectPath).taskQueue.execute(() -> {
        Throwable error = null;
        try {
          while (!processHandler.waitFor()) {
            LOG.info("processHandler.waitFor() returned false for session " + future.getRequestID() + ", continue waiting");
          }
        }
        catch (Throwable e) {
          error = e;
        }
        finally {
          notifySessionTerminationIfNeeded(future.getRequestID(), error);
        }
      });
    });
  }
private void cancelPreloadedBuilds(@NotNull String projectPath)