vm = launchTarget("com.sun.tools.example.trace.Hello", false);
EventQueue eventQ = vm.eventQueue();
boolean connected = true;
while (connected) {
try {
EventSet eventSet = queue.remove();
EventIterator it = eventSet.eventIterator();
while (it.hasNext()) {
handleEvent(it.nextEvent());
}
eventSet.resume();
} catch (InterruptedException exc) {
// Ignore
} catch (VMDisconnectedException discExc) {
//handleDisconnectedException();
break;
}
}
VMStartEvent虚拟机在此行中挂起
EventSet eventSet = queue.remove();
VM使用suspend = false
启动。我用java 1.7