private static void dumpThreads(@Nullable Project project, @NotNull ModalityState initialState) {
    final ThreadInfo[] infos = ThreadDumper.getThreadInfos();
    final String edtTrace = ThreadDumper.dumpEdtStackTrace(infos);
    if (edtTrace.contains("java.lang.ClassLoader.loadClass")) {
      return;
    }

    final boolean isInDumbMode = project != null && !project.isDisposed() && DumbService.isDumb(project);

    ApplicationManager.getApplication().invokeLater(() -> {
      if (!initialState.equals(ModalityState.current())) return;
      sendDumpsInBackground(infos, isInDumbMode);
    }, ModalityState.any());
  }
private static void dumpThreads(@Nullable Project project, @NotNull ModalityState initialState)