本文整理汇总了Java中com.sun.jdi.ThreadReference类的典型用法代码示例。如果您正苦于以下问题:Java ThreadReference类的具体用法?Java ThreadReference怎么用?Java ThreadReference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ThreadReference类属于com.sun.jdi包,在下文中一共展示了ThreadReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ungrabWindowAWT
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
private boolean ungrabWindowAWT(ThreadReference tr, ObjectReference grabbedWindow) {
// Call XBaseWindow.ungrabInput()
try {
VirtualMachine vm = MirrorWrapper.virtualMachine(grabbedWindow);
List<ReferenceType> xbaseWindowClassesByName = VirtualMachineWrapper.classesByName(vm, "sun.awt.X11.XBaseWindow");
if (xbaseWindowClassesByName.isEmpty()) {
logger.info("Unable to release X grab, no XBaseWindow class in target VM "+VirtualMachineWrapper.description(vm));
return false;
}
ClassType XBaseWindowClass = (ClassType) xbaseWindowClassesByName.get(0);
Method ungrabInput = XBaseWindowClass.concreteMethodByName("ungrabInput", "()V");
if (ungrabInput == null) {
logger.info("Unable to release X grab, method ungrabInput not found in target VM "+VirtualMachineWrapper.description(vm));
return false;
}
XBaseWindowClass.invokeMethod(tr, ungrabInput, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
} catch (VMDisconnectedExceptionWrapper vmdex) {
return true; // Disconnected, all is good.
} catch (Exception ex) {
logger.log(Level.INFO, "Unable to release X grab.", ex);
return false;
}
return true;
}
示例2: removeThread
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
static void removeThread(ThreadReference thread) {
if (thread.equals(ThreadInfo.current)) {
// Current thread has died.
// Be careful getting the thread name. If its death happens
// as part of VM termination, it may be too late to get the
// information, and an exception will be thrown.
String currentThreadName;
try {
currentThreadName = "\"" + thread.name() + "\"";
} catch (Exception e) {
currentThreadName = "";
}
setCurrentThread(null);
MessageOutput.println();
MessageOutput.println("Current thread died. Execution continuing...",
currentThreadName);
}
threads.remove(getThreadInfo(thread));
}
示例3: resume
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
private CompletableFuture<Response> resume(Requests.ContinueArguments arguments, Response response, IDebugAdapterContext context) {
boolean allThreadsContinued = true;
ThreadReference thread = DebugUtility.getThread(context.getDebugSession(), arguments.threadId);
/**
* See the jdi doc https://docs.oracle.com/javase/7/docs/jdk/api/jpda/jdi/com/sun/jdi/ThreadReference.html#resume(),
* suspends of both the virtual machine and individual threads are counted. Before a thread will run again, it must
* be resumed (through ThreadReference#resume() or VirtualMachine#resume()) the same number of times it has been suspended.
*/
if (thread != null) {
allThreadsContinued = false;
DebugUtility.resumeThread(thread);
checkThreadRunningAndRecycleIds(thread, context);
} else {
context.getDebugSession().resume();
context.getRecyclableIdPool().removeAllObjects();
}
response.body = new Responses.ContinueResponseBody(allThreadsContinued);
return CompletableFuture.completedFuture(response);
}
示例4: notifyToBeResumedAllNoFire
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
public void notifyToBeResumedAllNoFire(Set<ThreadReference> ignoredThreads) {
Collection threads = threadsTranslation.getTranslated();
for (Iterator it = threads.iterator(); it.hasNext(); ) {
Object threadOrGroup = it.next();
if (threadOrGroup instanceof JPDAThreadImpl &&
(ignoredThreads == null || !ignoredThreads.contains(threadOrGroup))) {
int status = ((JPDAThreadImpl) threadOrGroup).getState();
boolean invalid = (status == JPDAThread.STATE_NOT_STARTED ||
status == JPDAThread.STATE_UNKNOWN ||
status == JPDAThread.STATE_ZOMBIE);
if (!invalid) {
((JPDAThreadImpl) threadOrGroup).notifyToBeResumedNoFire();
} else if (status == JPDAThread.STATE_UNKNOWN || status == JPDAThread.STATE_ZOMBIE) {
threadsTranslation.remove(((JPDAThreadImpl) threadOrGroup).getThreadReference());
}
}
}
}
示例5: getThreadsCache
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
public ThreadsCache getThreadsCache() {
synchronized (threadsCollectorLock) {
if (threadsCache == null) {
threadsCache = new ThreadsCache(this);
threadsCache.addPropertyChangeListener(new PropertyChangeListener() {
// Re-fire the changes
@Override
public void propertyChange(PropertyChangeEvent evt) {
String propertyName = evt.getPropertyName();
if (ThreadsCache.PROP_THREAD_STARTED.equals(propertyName)) {
firePropertyChange(PROP_THREAD_STARTED, null, getThread((ThreadReference) evt.getNewValue()));
}
if (ThreadsCache.PROP_THREAD_DIED.equals(propertyName)) {
firePropertyChange(PROP_THREAD_DIED, getThread((ThreadReference) evt.getOldValue()), null);
}
if (ThreadsCache.PROP_GROUP_ADDED.equals(propertyName)) {
firePropertyChange(PROP_THREAD_GROUP_ADDED, null, getThreadGroup((ThreadGroupReference) evt.getNewValue()));
}
}
});
}
return threadsCache;
}
}
示例6: run
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
@Override
public void run() {
List<ThreadReference> allThreads = vm.allThreads();
System.err.println("All Threads:");
for (ThreadReference tr : allThreads) {
String name = tr.name();
boolean suspended = tr.isSuspended();
int suspendCount = tr.suspendCount();
int status = tr.status();
System.err.println(name+"\t SUSP = "+suspended+", COUNT = "+suspendCount+", STATUS = "+status);
}
System.err.println("");
if (!finish) {
rp.post(this, INTERVAL);
}
}
示例7: createTranslation
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
/**
* Creates a new translated node for given original one.
*
* @param o a node to be translated
* @return a new translated node
*/
private Object createTranslation (Object o) {
switch (translationID) {
case THREAD_ID:
if (o instanceof ThreadReference) {
return new JPDAThreadImpl ((ThreadReference) o, debugger);
} else if (o instanceof ThreadGroupReference) {
return new JPDAThreadGroupImpl ((ThreadGroupReference) o, debugger);
} else {
return null;
}
case LOCALS_ID:
if (o instanceof ArrayType) {
return new JPDAArrayTypeImpl(debugger, (ArrayType) o);
}
if (o instanceof ReferenceType) {
return new JPDAClassTypeImpl(debugger, (ReferenceType) o);
}
default:
throw new IllegalStateException(""+o);
}
}
示例8: initGroups
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
private void initGroups(ThreadGroupReference group) {
try {
List<ThreadGroupReference> groups = new ArrayList(ThreadGroupReferenceWrapper.threadGroups0(group));
List<ThreadReference> threads = new ArrayList(ThreadGroupReferenceWrapper.threads0(group));
filterThreads(threads);
groupMap.put(group, groups);
threadMap.put(group, threads);
for (ThreadGroupReference g : groups) {
initGroups(g);
}
} catch (ObjectCollectedException e) {
}
}
示例9: jdwpStatus
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
private JDWP.ThreadReference.Status jdwpStatus() {
LocalCache snapshot = localCache;
JDWP.ThreadReference.Status myStatus = snapshot.status;
try {
if (myStatus == null) {
myStatus = JDWP.ThreadReference.Status.process(vm, this);
if ((myStatus.suspendStatus & SUSPEND_STATUS_SUSPENDED) != 0) {
// thread is suspended, we can cache the status.
snapshot.status = myStatus;
}
}
} catch (JDWPException exc) {
throw exc.toJDIException();
}
return myStatus;
}
示例10: containsObsoleteMethods
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
private boolean containsObsoleteMethods() throws DebugException {
List<ThreadReference> threads = currentDebugSession.getAllThreads();
for (ThreadReference thread : threads) {
if (!thread.isSuspended()) {
continue;
}
List<StackFrame> frames = getStackFrames(thread, false);
if (frames == null || frames.isEmpty()) {
continue;
}
for (StackFrame frame : frames) {
if (StackFrameUtility.isObsolete(frame)) {
return true;
}
}
}
return false;
}
示例11: notifyMethodInvoking
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
public void notifyMethodInvoking(ThreadReference tr) {
if (logger.isLoggable(Level.FINE)) {
try {
logger.fine(" notifyMethodInvoking("+tr+") suspendCount = "+tr.suspendCount());
} catch (Exception ex) {
logger.fine(" notifyMethodInvoking("+tr+")");
}
}
if (Thread.currentThread() == thread) {
// start another event handler thread...
startEventHandlerThreadFor(tr);
}
synchronized (methodInvokingThreads) {
methodInvokingThreads.add(tr);
}
loopControl.setInMethodInvoke(true);
}
示例12: notifyMethodInvokeDone
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
public void notifyMethodInvokeDone(ThreadReference tr) {
if (logger.isLoggable(Level.FINE)) {
logger.fine(" notifyMethodInvokeDone("+tr+")");
}
if (Thread.currentThread() == thread) {
HandlerTask task = eventHandlers.remove(tr);
if (task != null) {
task.cancel();
}
}
boolean done;
synchronized (methodInvokingThreads) {
methodInvokingThreads.remove(tr);
done = methodInvokingThreads.isEmpty();
}
if (done) {
loopControl.setInMethodInvoke(false);
}
}
示例13: stepDone
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
private void stepDone(EventRequest er) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
JPDAThreadImpl t;
if (er instanceof StepRequest) {
StepRequest sr = (StepRequest) er;
t = ((JPDADebuggerImpl) debugger).getThread(StepRequestWrapper.thread(sr));
} else {
ThreadReference tr = (ThreadReference) EventRequestWrapper.getProperty(er, "thread"); // NOI18N
if (tr != null) {
t = ((JPDADebuggerImpl) debugger).getThread(tr);
} else {
t = null;
}
}
if (t != null) {
t.setInStep(false, null);
}
}
示例14: resume
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
public void resume() {
switch (suspendPolicy()) {
case EventRequest.SUSPEND_ALL:
vm.resume();
break;
case EventRequest.SUSPEND_EVENT_THREAD:
ThreadReference thread = eventThread();
if (thread == null) {
throw new InternalException("Inconsistent suspend policy");
}
thread.resume();
break;
case EventRequest.SUSPEND_NONE:
// Do nothing
break;
default:
throw new InternalException("Invalid suspend policy");
}
}
示例15: frameCount
import com.sun.jdi.ThreadReference; //导入依赖的package包/类
public int frameCount() throws IncompatibleThreadStateException {
LocalCache snapshot = localCache;
try {
if (snapshot.frameCount == -1) {
snapshot.frameCount = JDWP.ThreadReference.FrameCount
.process(vm, this).frameCount;
}
} catch (JDWPException exc) {
switch (exc.errorCode()) {
case JDWP.Error.THREAD_NOT_SUSPENDED:
case JDWP.Error.INVALID_THREAD: /* zombie */
throw new IncompatibleThreadStateException();
default:
throw exc.toJDIException();
}
}
return snapshot.frameCount;
}