@Override public final void action() throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("trying " + this); } final SuspendContextImpl suspendContext = getSuspendContext(); if (suspendContext == null) { if (LOG.isDebugEnabled()) { LOG.debug("skip processing - context is null " + this); } notifyCancelled(); return; } if (suspendContext.myInProgress) { suspendContext.postponeCommand(this); } else { try { if (!suspendContext.isResumed()) { suspendContext.myInProgress = true; contextAction(suspendContext); } else { notifyCancelled(); } } finally { suspendContext.myInProgress = false; if (suspendContext.isResumed()) { for (SuspendContextCommandImpl postponed = suspendContext.pollPostponedCommand(); postponed != null; postponed = suspendContext.pollPostponedCommand()) { postponed.notifyCancelled(); } } else { SuspendContextCommandImpl postponed = suspendContext.pollPostponedCommand(); if (postponed != null) { final Stack<SuspendContextCommandImpl> stack = new Stack<>(); while (postponed != null) { stack.push(postponed); postponed = suspendContext.pollPostponedCommand(); } final DebuggerManagerThreadImpl managerThread = suspendContext.getDebugProcess().getManagerThread(); while (!stack.isEmpty()) { managerThread.pushBack(stack.pop()); } } } } } }
protected void commandCancelled() { if (!DebuggerManagerThreadImpl.isManagerThread()) { return; } // context thread is not suspended final DebuggerContextImpl context = getDebuggerContext(); final SuspendContextImpl suspendContext = context.getSuspendContext(); if (suspendContext == null) { return; } final ThreadReferenceProxyImpl threadToSelect = context.getThreadProxy(); if (threadToSelect == null) { return; } if (!suspendContext.isResumed()) { final SuspendContextImpl threadContext = SuspendManagerUtil.getSuspendContextForThread(suspendContext, threadToSelect); context .getDebugProcess() .getManagerThread() .schedule(new RebuildFramesListCommand(context, threadContext)); refillThreadsCombo(threadToSelect); } }