Search in sources :

Example 1 with DebuggerManagerThreadImpl

use of com.intellij.debugger.engine.DebuggerManagerThreadImpl in project intellij-community by JetBrains.

the class SuspendContextCommandImpl method action.

@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());
                    }
                }
            }
        }
    }
}
Also used : DebuggerManagerThreadImpl(com.intellij.debugger.engine.DebuggerManagerThreadImpl) SuspendContextImpl(com.intellij.debugger.engine.SuspendContextImpl) Stack(com.intellij.util.containers.Stack)

Aggregations

DebuggerManagerThreadImpl (com.intellij.debugger.engine.DebuggerManagerThreadImpl)1 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)1 Stack (com.intellij.util.containers.Stack)1