private static boolean specialSuspendProcessingForAlwaysSwitch(@NotNull SuspendContextImpl suspendContext,
                                                                 @NotNull LocatableEventRequestor requestor,
                                                                 @NotNull SuspendManagerImpl suspendManager,
                                                                 @NotNull ThreadReference thread) {
    DebugProcessImpl debugProcess = suspendContext.getDebugProcess();
    if (suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_ALL) {
      if (!(requestor instanceof SuspendOtherThreadsRequestor)) {
        LOG.warn("Requestor " + requestor + " performed unsafe suspend-all suspend");
      }
      return false;
    }
    if (suspendContext.getSuspendPolicy() != EventRequest.SUSPEND_EVENT_THREAD) {
      debugProcess.logError("Suspend context " + suspendContext + " has non-thread suspend policy");
    }

    if (!DebuggerSettings.SUSPEND_ALL.equals(requestor.getSuspendPolicy())) {
      logSuspendContext(suspendContext, "usual suspend-thread breakpoint/stepping");
      return false;
    }

    Function<SuspendContextImpl, Boolean> afterSwitch = null;
    if (requestor instanceof CustomProcessingLocatableEventRequestor customRequestor) {
      logSuspendContext(suspendContext, "switcher stepping will be applied");
      afterSwitch = customRequestor.applyAfterContextSwitch();
    }
    if (afterSwitch == null) {
      afterSwitch = c -> true;
    }
    boolean noStandardSuspendNeeded;
    List<SuspendContextImpl> suspendAllContexts =
      ContainerUtil.filter(suspendManager.getEventContexts(), c -> c.getSuspendPolicy() == EventRequest.SUSPEND_ALL);
    if (!suspendAllContexts.isEmpty()) {
      logSuspendContext(suspendContext, "join with suspend-all context");
      if (suspendAllContexts.size() > 1) {
        debugProcess.logError("Many suspend all switch contexts: " + suspendAllContexts);
      }

      noStandardSuspendNeeded = true;
      ThreadReferenceProxyImpl threadProxy = suspendContext.getVirtualMachine().getThreadReferenceProxy(thread);
      if (suspendManager.myExplicitlyResumedThreads.contains(threadProxy)) {
        for (SuspendContextImpl context : suspendManager.getEventContexts()) {
          if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL && !context.suspends(threadProxy)) {
            suspendManager.suspendThread(context, threadProxy);
          }
        }
        suspendManager.myExplicitlyResumedThreads.remove(threadProxy);
        suspendManager.voteResume(suspendContext);
        SuspendManagerUtil.switchToThreadInSuspendAllContext(suspendAllContexts.get(0), threadProxy);
      }
      else {
        // Already stopped, so this is "remaining" event. Need to resume the event.
        List<SuspendContextImpl> suspendAllSwitchContexts =
          ContainerUtil.filter(suspendManager.getEventContexts(), c -> c.mySuspendAllSwitchedContext);
        if (suspendAllSwitchContexts.size() != 1) {
          debugProcess.logError("Requires just one suspend all switch context, but have: " + suspendAllSwitchContexts);
        }
        if (thread.suspendCount() == 1) {
          // There are some errors in evaluation-resume-suspend logic
          debugProcess.logError("This means resuming thead " + thread + " to the running state for " + suspendContext);
        }
        LOG.warn("Yet another thread has been stopped: " + suspendContext);
        suspendManager.voteResume(suspendContext);
        debugProcess.notifyStoppedOtherThreads();
      }
    }
    else {
      logSuspendContext(suspendContext, "initiate transfer to suspend-all");
      noStandardSuspendNeeded = SuspendOtherThreadsRequestor.initiateTransferToSuspendAll(suspendContext, afterSwitch);
    }

    return noStandardSuspendNeeded;
  }
private static boolean specialSuspendProcessingForAlwaysSwitch(@NotNull SuspendContextImpl suspendContext,
                                                                 @NotNull LocatableEventRequestor requestor,
                                                                 @NotNull SuspendManagerImpl suspendManager,
                                                                 @NotNull ThreadReference thread)