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());
}
}
}
}
}
}
Aggregations