reverted back suspend changes, reason: suspend context commands added after the VM is explicitly paused, were postponed forever; The suspendContext, that is a result of the user's "pause" action is now pushed to the "myPausedContexts" collection

This commit is contained in:
Eugene Zhuravlev
2005-01-20 22:00:18 +03:00
parent 8c3d7bb7fb
commit 09e64dbea4
5 changed files with 18 additions and 16 deletions

View File

@@ -106,7 +106,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
private final DescriptorHistoryManager myDescriptorHistoryManager;
private final NodeRendererManagerImpl myNodeRendererManager = new NodeRendererManagerImpl(this);
private final SuspendManager mySuspendManager = new SuspendManagerImpl(this);
private final SuspendManagerImpl mySuspendManager = new SuspendManagerImpl(this);
protected CompoundPositionManager myPositionManager = null;
DebuggerManagerThreadImpl myDebuggerManagerThread;
public static final String MSG_FAILD_TO_CONNECT = "Failed to establish connection to the target VM";
@@ -1243,9 +1243,8 @@ public abstract class DebugProcessImpl implements DebugProcess {
logThreads();
getVirtualMachineProxy().suspend();
logThreads();
SuspendContextImpl suspendContext = getSuspendManager().pushSuspendContext(EventRequest.SUSPEND_ALL, 0);
myDebugProcessDispatcher.getMulticaster().paused(suspendContext);
SuspendContextImpl suspendContext = mySuspendManager.pushSuspendContext(EventRequest.SUSPEND_ALL, 0);
mySuspendManager.notifyPaused(suspendContext);
}
}

View File

@@ -265,7 +265,7 @@ public class SuspendManagerImpl implements SuspendManager {
}
}
private void notifyPaused(SuspendContextImpl suspendContext) {
public void notifyPaused(SuspendContextImpl suspendContext) {
pushPausedContext(suspendContext);
myDebugProcess.myDebugProcessDispatcher.getMulticaster().paused(suspendContext);
}

View File

@@ -31,15 +31,10 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
public final void contextAction() throws Exception {
final SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
final boolean isSuspended = suspendManager.isSuspended(myDebuggerContext.getThreadProxy());
if(isSuspended) {
if (LOG.isDebugEnabled()) {
LOG.debug("Context thread " + getSuspendContext().getThread());
LOG.debug("Debug thread" + myDebuggerContext.getThreadProxy());
}
threadAction();
}
else {
Set<SuspendContextImpl> suspendingContexts = SuspendManagerUtil.getSuspendingContexts(suspendManager, myDebuggerContext.getThreadProxy());
if(suspendingContexts.isEmpty()) {
// there are no suspend context currently registered
SuspendContextImpl threadContext = SuspendManagerUtil.findContextByThread(suspendManager, myDebuggerContext.getThreadProxy());
if(threadContext != null) {
SuspendManagerUtil.postponeCommand(threadContext, this);
@@ -48,6 +43,13 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
notifyCancelled();
}
}
else {
if (LOG.isDebugEnabled()) {
LOG.debug("Context thread " + getSuspendContext().getThread());
LOG.debug("Debug thread" + myDebuggerContext.getThreadProxy());
}
threadAction();
}
}
abstract public void threadAction ();

View File

@@ -40,6 +40,7 @@ public class EventQueue<E> {
}
public void close(){
System.out.println("EVENTS CLOSED!!!");
if (LOG.isDebugEnabled()) {
LOG.debug("events closed");
}

View File

@@ -528,7 +528,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
try {
StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor();
StackFrameProxyImpl frame = stackDescriptor.getStackFrame();
//if(!getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(frame.threadProxy())) return;
if(!getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(frame.threadProxy())) return;
LOG.assertTrue(frame.threadProxy().isSuspended());
@@ -571,7 +571,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
public void threadAction() {
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl)getNode().getDescriptor());
ThreadReferenceProxyImpl threadProxy = threadDescriptor.getThreadReference();
if (!threadProxy.isCollected() /*&& getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(threadProxy)*/) {
if (!threadProxy.isCollected() && getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(threadProxy)) {
int status = threadProxy.status();
if (!(status == ThreadReference.THREAD_STATUS_UNKNOWN) &&
!(status == ThreadReference.THREAD_STATUS_NOT_STARTED) &&