use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.
the class DebuggerContextCommandImpl method contextAction.
@Override
public final void contextAction(@NotNull SuspendContextImpl suspendContext) throws Exception {
SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
boolean isSuspendedByContext;
try {
isSuspendedByContext = suspendManager.isSuspended(getThread());
} catch (ObjectCollectedException ignored) {
notifyCancelled();
return;
}
if (isSuspendedByContext) {
if (LOG.isDebugEnabled()) {
LOG.debug("Context thread " + suspendContext.getThread());
LOG.debug("Debug thread" + getThread());
}
threadAction(suspendContext);
} else {
// no suspend context currently available
SuspendContextImpl suspendContextForThread = myCustomThread != null ? suspendContext : SuspendManagerUtil.findContextByThread(suspendManager, getThread());
if (suspendContextForThread != null) {
suspendContextForThread.postponeCommand(this);
} else {
notifyCancelled();
}
}
}
use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.
the class ThreadDescriptorImpl method setContext.
public void setContext(EvaluationContextImpl context) {
final ThreadReferenceProxyImpl thread = getThreadReference();
final SuspendManager suspendManager = context != null ? context.getDebugProcess().getSuspendManager() : null;
final SuspendContextImpl suspendContext = context != null ? context.getSuspendContext() : null;
try {
myIsSuspended = suspendManager != null ? suspendManager.isSuspended(thread) : thread.isSuspended();
} catch (ObjectCollectedException e) {
myIsSuspended = false;
}
myIsExpandable = calcExpandable(myIsSuspended);
mySuspendContext = suspendManager != null ? SuspendManagerUtil.findContextByThread(suspendManager, thread) : suspendContext;
myIsAtBreakpoint = thread.isAtBreakpoint();
myIsCurrent = suspendContext != null ? suspendContext.getThread() == thread : false;
myIsFrozen = suspendManager != null ? suspendManager.isFrozen(thread) : myIsSuspended;
}
use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.
the class ThreadGroupDescriptorImpl method calcRepresentation.
protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException {
DebuggerManagerThreadImpl.assertIsManagerThread();
ThreadGroupReferenceProxyImpl group = getThreadGroupReference();
try {
myName = group.name();
return DebuggerBundle.message("label.thread.group.node", myName, group.uniqueID());
} catch (ObjectCollectedException e) {
return myName != null ? DebuggerBundle.message("label.thread.group.node.group.collected", myName) : "";
}
}
use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.
the class ThreadDescriptorImpl method calcRepresentation.
protected String calcRepresentation(EvaluationContextImpl context, DescriptorLabelListener labelListener) throws EvaluateException {
DebuggerManagerThreadImpl.assertIsManagerThread();
ThreadReferenceProxyImpl thread = getThreadReference();
try {
myName = thread.name();
ThreadGroupReferenceProxyImpl gr = getThreadReference().threadGroupProxy();
final String grname = (gr != null) ? gr.name() : null;
final String threadStatusText = DebuggerUtilsEx.getThreadStatusText(getThreadReference().status());
//noinspection HardCodedStringLiteral
if (grname != null && !"SYSTEM".equalsIgnoreCase(grname)) {
return DebuggerBundle.message("label.thread.node.in.group", myName, thread.uniqueID(), threadStatusText, grname);
}
return DebuggerBundle.message("label.thread.node", myName, thread.uniqueID(), threadStatusText);
} catch (ObjectCollectedException e) {
return myName != null ? DebuggerBundle.message("label.thread.node.thread.collected", myName) : "";
}
}
use of com.sun.jdi.ObjectCollectedException in project intellij-community by JetBrains.
the class CodeFragmentFactoryContextWrapper method createMarkupVariablesText.
private static Pair<String, Map<String, ObjectReference>> createMarkupVariablesText(Map<?, ValueMarkup> markupMap) {
final Map<String, ObjectReference> reverseMap = new HashMap<>();
final StringBuilder buffer = StringBuilderSpinAllocator.alloc();
try {
for (Map.Entry<?, ValueMarkup> entry : markupMap.entrySet()) {
ObjectReference objectRef = (ObjectReference) entry.getKey();
final ValueMarkup markup = entry.getValue();
String labelName = markup.getText();
if (!StringUtil.isJavaIdentifier(labelName)) {
continue;
}
try {
final String typeName = objectRef.type().name();
labelName += DEBUG_LABEL_SUFFIX;
if (buffer.length() > 0) {
buffer.append("\n");
}
buffer.append(typeName).append(" ").append(labelName).append(";");
reverseMap.put(labelName, objectRef);
} catch (ObjectCollectedException e) {
//it.remove();
}
}
buffer.append(" ");
return Pair.create(buffer.toString(), reverseMap);
} finally {
StringBuilderSpinAllocator.dispose(buffer);
}
}
Aggregations