Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 jdk.jdi.jmod - JDI Tool
JDK 17 jdk.jdi.jmod is the JMOD file for JDK 17 JDI (Java Debug Interface) tool.
JDK 17 JDI tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jdi.jmod.
JDK 17 JDI tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JDI tool source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jdi.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ com/sun/tools/jdi/VMState.java
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.sun.tools.jdi;
import java.lang.ref.WeakReference;
import java.util.*;
import com.sun.jdi.ThreadGroupReference;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.VirtualMachine;
class VMState {
private final VirtualMachineImpl vm;
// Listeners
private final List<WeakReference<VMListener>> listeners = new ArrayList<>(); // synchronized (this)
private boolean notifyingListeners = false; // synchronized (this)
/*
* Certain information can be cached only when the entire VM is
* suspended and there are no pending resumes. The field below
* is used to track whether there are pending resumes.
*/
private final Set<Integer> pendingResumeCommands = Collections.synchronizedSet(new HashSet<>());
// This is cached only while the VM is suspended
private static class Cache {
List<ThreadGroupReference> groups = null; // cached Top Level ThreadGroups
List<ThreadReference> threads = null; // cached Threads
}
private Cache cache = null; // synchronized (this)
private static final Cache markerCache = new Cache();
private void disableCache() {
synchronized (this) {
cache = null;
}
}
private void enableCache() {
synchronized (this) {
cache = markerCache;
}
}
private Cache getCache() {
synchronized (this) {
if (cache == markerCache) {
cache = new Cache();
}
return cache;
}
}
VMState(VirtualMachineImpl vm) {
this.vm = vm;
}
/**
* Is the VM currently suspended, for the purpose of caching?
* Must be called synchronized on vm.state()
*/
boolean isSuspended() {
return cache != null;
}
/*
* A JDWP command has been completed (reply has been received).
* Update data that tracks pending resume commands.
*/
void notifyCommandComplete(int id) {
pendingResumeCommands.remove(id);
}
synchronized void freeze() {
if (cache == null && (pendingResumeCommands.isEmpty())) {
/*
* No pending resumes to worry about. The VM is suspended
* and additional state can be cached. Notify all
* interested listeners.
*/
processVMAction(new VMAction(vm, VMAction.VM_SUSPENDED));
enableCache();
}
}
synchronized PacketStream thawCommand(CommandSender sender) {
PacketStream stream = sender.send();
pendingResumeCommands.add(stream.id());
thaw();
return stream;
}
/**
* All threads are resuming
*/
void thaw() {
thaw(null);
}
/**
* 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));
}
private synchronized void processVMAction(VMAction action) {
if (!notifyingListeners) {
// Prevent recursion
notifyingListeners = true;
Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference<VMListener> ref = iter.next();
VMListener listener = ref.get();
if (listener != null) {
boolean keep = true;
switch (action.id()) {
case VMAction.VM_SUSPENDED:
keep = listener.vmSuspended(action);
break;
case VMAction.VM_NOT_SUSPENDED:
keep = listener.vmNotSuspended(action);
break;
}
if (!keep) {
iter.remove();
}
} else {
// Listener is unreachable; clean up
iter.remove();
}
}
notifyingListeners = false;
}
}
synchronized void addListener(VMListener listener) {
listeners.add(new WeakReference<VMListener>(listener));
}
synchronized boolean hasListener(VMListener listener) {
Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference<VMListener> ref = iter.next();
if (listener.equals(ref.get())) {
return true;
}
}
return false;
}
synchronized void removeListener(VMListener listener) {
Iterator<WeakReference<VMListener>> iter = listeners.iterator();
while (iter.hasNext()) {
WeakReference<VMListener> ref = iter.next();
if (listener.equals(ref.get())) {
iter.remove();
break;
}
}
}
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;
}
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;
}
}
⏎ com/sun/tools/jdi/VMState.java
Or download all of them as a single archive file:
File name: jdk.jdi-17.0.5-src.zip File size: 476972 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jdwp.agent.jmod - JDWP Agent Module
2023-04-17, ≈54🔥, 0💬
Popular Posts:
Apache ZooKeeper is an open-source server which enables highly reliable distributed coordination. Ap...
JDK 11 jdk.jlink.jmod is the JMOD file for JDK 11 JLink tool, which can be invoked by the "jlink" co...
JDK 17 jdk.jdi.jmod is the JMOD file for JDK 17 JDI (Java Debug Interface) tool. JDK 17 JDI tool com...
JDK 11 java.naming.jmod is the JMOD file for JDK 11 Naming module. JDK 11 Naming module compiled cla...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...