@Override
    public void run() {
      try {
        EventQueue eventQueue = myVmProxy.getVirtualMachine().eventQueue();
        while (!isStopped()) {
          try {
            final EventSet eventSet = eventQueue.remove();

            myDebuggerManagerThread.invokeAndWait(new DebuggerCommandImpl(PrioritizedTask.Priority.HIGH) {
              @Override
              protected void action() {
                int processed = 0;
                for (Event event : eventSet) {
                  if (myReturnValueWatcher != null && myReturnValueWatcher.isTrackingEnabled()) {
                    if (myReturnValueWatcher.processEvent(event)) {
                      processed++;
                      continue;
                    }
                  }
                  Consumer<? super Event> handler = getEventRequestHandler(event);
                  if (handler != null) {
                    handler.accept(event);
                    processed++;
                  }
                }

                if (processed == eventSet.size()) {
                  DebuggerUtilsAsync.resume(eventSet);
                  return;
                }

                LocatableEvent locatableEvent = getLocatableEvent(eventSet);

                if (skipEvent(locatableEvent)) {
                  return;
                }

                SuspendContextImpl suspendContext = null;

                if (isResumeOnlyCurrentThread() && locatableEvent != null) {
                  for (SuspendContextImpl context : getSuspendManager().getEventContexts()) {
                    ThreadReferenceProxyImpl threadProxy = context.getVirtualMachine().getThreadReferenceProxy(locatableEvent.thread());
                    if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL &&
                        context.isExplicitlyResumed(threadProxy)) {
                      context.myResumedThreads.remove(threadProxy);
                      suspendContext = context;
                      suspendContext.myVotesToVote = eventSet.size();
                      break;
                    }
                  }
                }

                if (suspendContext == null) {
                  suspendContext = getSuspendManager().pushSuspendContext(eventSet);
                }

                Set<ClassPrepareRequestor> notifiedClassPrepareEventRequestors = null;
                ReferenceType lastPreparedClass = null;

                for (Event event : eventSet) {
                  if (getEventRequestHandler(event) != null) { // handled before
                    getSuspendManager().voteResume(suspendContext);
                    continue;
                  }

                  //if (LOG.isDebugEnabled()) {
                  //  LOG.debug("EVENT : " + event);
                  //}
                  try {
                    if (event instanceof VMStartEvent) {
                      //Sun WTK fails when J2ME when event set is resumed on VMStartEvent
                      processVMStartEvent(suspendContext, (VMStartEvent)event);
                    }
                    else if (event instanceof VMDeathEvent || event instanceof VMDisconnectEvent) {
                      processVMDeathEvent(suspendContext, event);
                    }
                    else if (event instanceof ClassPrepareEvent) {
                      if (eventSet.size() > 1) {
                        // check for more than one different thread
                        if (StreamEx.of(eventSet).select(ClassPrepareEvent.class).map(ClassPrepareEvent::thread).toSet().size() > 1) {
                          logError("Two different threads in ClassPrepareEvents: " + eventSet);
                        }
                      }
                      if (notifiedClassPrepareEventRequestors == null) {
                        notifiedClassPrepareEventRequestors = new HashSet<>(eventSet.size());
                      }
                      ReferenceType type = ((ClassPrepareEvent)event).referenceType();
                      if (lastPreparedClass != null && !lastPreparedClass.equals(type)) {
                        logError("EventSet contains ClassPrepareEvents for: " + lastPreparedClass + " and " + type);
                      }
                      lastPreparedClass = type;

                      processClassPrepareEvent(suspendContext, (ClassPrepareEvent)event, notifiedClassPrepareEventRequestors);
                    }
                    else if (event instanceof LocatableEvent locEvent) {
                      preloadEventInfo(locEvent.thread(), locEvent.location());
                      if (eventSet.size() > 1) {
                        // check for more than one different thread
                        if (StreamEx.of(eventSet).select(LocatableEvent.class).map(LocatableEvent::thread).toSet().size() > 1) {
                          logError("Two different threads in LocatableEvents: " + eventSet);
                        }
                      }
                      //AccessWatchpointEvent, BreakpointEvent, ExceptionEvent, MethodEntryEvent, MethodExitEvent,
                      //ModificationWatchpointEvent, StepEvent, WatchpointEvent
                      if (event instanceof StepEvent) {
                        processStepEvent(suspendContext, (StepEvent)event);
                      }
                      else {
                        processLocatableEvent(suspendContext, locEvent);
                      }
                    }
                    else if (event instanceof ClassUnloadEvent) {
                      processDefaultEvent(suspendContext);
                    }
                  }
                  catch (VMDisconnectedException e) {
                    LOG.debug(e);
                  }
                  catch (InternalException e) {
                    LOG.info(e);
                  }
                  catch (Throwable e) {
                    logError("Top-level error during event processing", e);
                  }
                }
              }

              private boolean skipEvent(@Nullable LocatableEvent locatableEvent) {
                if (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL) {
                  // check if there is already one request with policy SUSPEND_ALL
                  for (SuspendContextImpl context : getSuspendManager().getEventContexts()) {
                    if (context.getSuspendPolicy() == EventRequest.SUSPEND_ALL) {
                      if (isResumeOnlyCurrentThread() && locatableEvent != null && !context.isEvaluating()) {
                        // if step event is present - switch context
                        getSuspendManager().resume(context);
                        //((SuspendManagerImpl)getSuspendManager()).popContext(context);
                      }
                      else if (!DebuggerSession.enableBreakpointsDuringEvaluation()) {
                        notifySkippedBreakpointInEvaluation(locatableEvent, context);
                        DebuggerUtilsAsync.resume(eventSet);
                        return true;
                      }
                    }
                  }
                }

                if (!isCurrentVirtualMachine(myVmProxy)) {
                  notifySkippedBreakpoints(locatableEvent, SkippedBreakpointReason.OTHER_VM);
                  DebuggerUtilsAsync.resume(eventSet);
                  return true;
                }

                return false;
              }

            });
          }
          catch (InterruptedException | ProcessCanceledException | VMDisconnectedException e) {
            throw e;
          }
          catch (Throwable e) {
            LOG.debug(e);
          }
        }
      }
      catch (InterruptedException | VMDisconnectedException e) {
        invokeVMDeathEvent();
      }
      finally {
        Thread.interrupted(); // reset interrupted status
      }
    }
@Override
    public void run()