本文整理汇总了Java中com.sun.jdi.VirtualMachine.TRACE_OBJREFS属性的典型用法代码示例。如果您正苦于以下问题:Java VirtualMachine.TRACE_OBJREFS属性的具体用法?Java VirtualMachine.TRACE_OBJREFS怎么用?Java VirtualMachine.TRACE_OBJREFS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.sun.jdi.VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.TRACE_OBJREFS属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: allThreads
List<ThreadReference> allThreads() {
List<ThreadReference> threads = null;
try {
Cache local = getCache();
if (local != null) {
// may be stale when returned, but not provably so
threads = local.threads;
}
if (threads == null) {
threads = Arrays.asList((ThreadReference[])JDWP.VirtualMachine.AllThreads.
process(vm).threads);
if (local != null) {
local.threads = threads;
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Caching all threads (count = " +
threads.size() + ") while VM suspended");
}
}
}
} catch (JDWPException exc) {
throw exc.toJDIException();
}
return threads;
}
示例2: topLevelThreadGroups
List<ThreadGroupReference> topLevelThreadGroups() {
List<ThreadGroupReference> groups = null;
try {
Cache local = getCache();
if (local != null) {
groups = local.groups;
}
if (groups == null) {
groups = Arrays.asList(
(ThreadGroupReference[])JDWP.VirtualMachine.TopLevelThreadGroups.
process(vm).groups);
if (local != null) {
local.groups = groups;
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(
"Caching top level thread groups (count = " +
groups.size() + ") while VM suspended");
}
}
}
} catch (JDWPException exc) {
throw exc.toJDIException();
}
return groups;
}
示例3: ownedMonitors
public List<ObjectReference> ownedMonitors() throws IncompatibleThreadStateException {
LocalCache snapshot = localCache;
try {
if (snapshot.ownedMonitors == null) {
snapshot.ownedMonitors = Arrays.asList(
(ObjectReference[])JDWP.ThreadReference.OwnedMonitors.
process(vm, this).owned);
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitors.size() + ")");
}
}
} 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.ownedMonitors;
}
示例4: vmNotSuspended
public boolean vmNotSuspended(VMAction action) {
// make sure that cache and listener management are synchronized
synchronized (vm.state()) {
if (cache != null && (vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing temporary cache for " + description());
}
disableCache();
if (addedListener) {
/*
* If a listener was added (i.e. this is not a
* ObjectReference that adds a listener on startup),
* remove it here.
*/
addedListener = false;
return false; // false says remove
} else {
return true;
}
}
}
示例5: visibleClasses
public List<ReferenceType> visibleClasses() {
List<ReferenceType> classes = null;
try {
Cache local = (Cache)getCache();
if (local != null) {
classes = local.visibleClasses;
}
if (classes == null) {
JDWP.ClassLoaderReference.VisibleClasses.ClassInfo[]
jdwpClasses = JDWP.ClassLoaderReference.VisibleClasses.
process(vm, this).classes;
classes = new ArrayList<>(jdwpClasses.length);
for (int i = 0; i < jdwpClasses.length; ++i) {
classes.add(vm.referenceType(jdwpClasses[i].typeID,
jdwpClasses[i].refTypeTag));
}
classes = Collections.unmodifiableList(classes);
if (local != null) {
local.visibleClasses = classes;
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching visible classes (count = " +
classes.size() + ")");
}
}
}
} catch (JDWPException exc) {
throw exc.toJDIException();
}
return classes;
}
示例6: thaw
/**
* Tell listeners to invalidate suspend-sensitive caches.
* If resumingThread != null, then only that thread is being
* resumed.
*/
synchronized void thaw(ThreadReference resumingThread) {
if (cache != null) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("Clearing VM suspended cache");
}
disableCache();
}
processVMAction(new VMAction(vm, resumingThread, VMAction.VM_NOT_SUSPENDED));
}
示例7: currentContendedMonitor
public ObjectReference currentContendedMonitor()
throws IncompatibleThreadStateException {
LocalCache snapshot = localCache;
try {
if (snapshot.contendedMonitor == null &&
!snapshot.triedCurrentContended) {
snapshot.contendedMonitor = JDWP.ThreadReference.CurrentContendedMonitor.
process(vm, this).monitor;
snapshot.triedCurrentContended = true;
if ((snapshot.contendedMonitor != null) &&
((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0)) {
vm.printTrace(description() +
" temporarily caching contended monitor"+
" (id = " + snapshot.contendedMonitor.uniqueID() + ")");
}
}
} 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.contendedMonitor;
}
示例8: ownedMonitorsAndFrames
public List<MonitorInfo> ownedMonitorsAndFrames() throws IncompatibleThreadStateException {
LocalCache snapshot = localCache;
try {
if (snapshot.ownedMonitorsInfo == null) {
JDWP.ThreadReference.OwnedMonitorsStackDepthInfo.monitor[] minfo;
minfo = JDWP.ThreadReference.OwnedMonitorsStackDepthInfo.process(vm, this).owned;
snapshot.ownedMonitorsInfo = new ArrayList<>(minfo.length);
for (int i=0; i < minfo.length; i++) {
MonitorInfo mon = new MonitorInfoImpl(vm, minfo[i].monitor, this, minfo[i].stack_depth);
snapshot.ownedMonitorsInfo.add(mon);
}
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching owned monitors"+
" (count = " + snapshot.ownedMonitorsInfo.size() + ")");
}
}
} 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.ownedMonitorsInfo;
}
示例9: jdwpMonitorInfo
JDWP.ObjectReference.MonitorInfo jdwpMonitorInfo()
throws IncompatibleThreadStateException {
JDWP.ObjectReference.MonitorInfo info = null;
try {
Cache local;
// getCache() and addlistener() must be synchronized
// so that no events are lost.
synchronized (vm.state()) {
local = getCache();
if (local != null) {
info = local.monitorInfo;
// Check if there will be something to cache
// and there is not already a listener
if (info == null && !vm.state().hasListener(this)) {
/* For other, less numerous objects, this is done
* in the constructor. Since there can be many
* ObjectReferences, the VM listener is installed
* and removed as needed.
* Listener must be installed before process()
*/
vm.state().addListener(this);
addedListener = true;
}
}
}
if (info == null) {
info = JDWP.ObjectReference.MonitorInfo.process(vm, this);
if (local != null) {
local.monitorInfo = info;
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace("ObjectReference " + uniqueID() +
" temporarily caching monitor info");
}
}
}
} catch (JDWPException exc) {
if (exc.errorCode() == JDWP.Error.THREAD_NOT_SUSPENDED) {
throw new IncompatibleThreadStateException();
} else {
throw exc.toJDIException();
}
}
return info;
}