public synchronized void removeCommand(@NotNull ConsoleCommunication consoleComm, boolean exceptionOccurred) {
    var queue = getQueue(consoleComm);
    if (queue == null) return;
    if (!queue.isEmpty()) {
      if (exceptionOccurred) {
        int value = queue.size();
        if (value > 1) {
          handlers.get(consoleComm).decreaseInputPromptCount(value - 1);
        }

        queue.clear();
        CommandQueueListener listener = myListeners.get(consoleComm);
        if (listener != null) {
          listener.removeAll();
        }
      }
      else {
        var command = queue.remove();
        if (!command.getText().isBlank() && !command.getText().equals(STUB)) {
          myListeners.get(consoleComm).removeCommand(command);
        }

        if (!queue.isEmpty()) {
          execCommand(consoleComm, queue.peek());
        }
      }
    }
  }
public synchronized void removeCommand(@NotNull ConsoleCommunication consoleComm, boolean exceptionOccurred)