private void stopAndRerunConsole(Boolean rerun, @NotNull @Nls String message, @Nullable @NlsContexts.TabTitle String displayName) {
    new Task.Backgroundable(myProject, message, true) {
      @Override
      public void run(@NotNull ProgressIndicator indicator) {
        if (myProcessHandler != null) {
          UIUtil.invokeAndWaitIfNeeded(() -> closeCommunication());

          boolean processStopped = myProcessHandler.waitFor(WAIT_BEFORE_FORCED_CLOSE_MILLIS);
          if (!processStopped) {
            tryKillProcess(myProcessHandler);
          }
          myProcessHandler.waitFor();
        }

        if (rerun) {
          ModalityUiUtil.invokeLaterIfNeeded(ModalityState.defaultModalityState(), () -> {
            PydevConsoleRunnerImpl.this.reRun(true, displayName);
          });
        }
        else {
          myConsoleListeners.clear();
        }
        if (PyConsoleUtil.isCommandQueueEnabled(myProject)) {
          myConsoleView.restoreQueueWindow(true);
        }
      }
    }.queue();
  }
private void stopAndRerunConsole(Boolean rerun, @NotNull @Nls String message, @Nullable @NlsContexts.TabTitle String displayName)