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.jcmd.jmod - JCmd Tool
JDK 17 jdk.jcmd.jmod is the JMOD file for JDK 17 JCmd tool,
which can be invoked by the "jcmd" command.
JDK 17 JCmd tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jcmd.jmod.
JDK 17 JCmd tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JCmd source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jcmd.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ sun/tools/common/ProcessArgumentMatcher.java
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package sun.tools.common;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import com.sun.tools.attach.VirtualMachine;
import com.sun.tools.attach.VirtualMachineDescriptor;
import sun.jvmstat.monitor.MonitorException;
import sun.jvmstat.monitor.MonitoredHost;
import sun.jvmstat.monitor.MonitoredVm;
import sun.jvmstat.monitor.MonitoredVmUtil;
import sun.jvmstat.monitor.VmIdentifier;
/**
* Class for finding process matching a process argument,
* excluding tool it self and returning a list containing
* the process identifiers.
*/
public class ProcessArgumentMatcher {
private String matchClass;
private String singlePid;
public ProcessArgumentMatcher(String pidArg) {
if (pidArg == null || pidArg.isEmpty()) {
throw new IllegalArgumentException("Pid string is invalid");
}
if (pidArg.charAt(0) == '-') {
throw new IllegalArgumentException("Unrecognized " + pidArg);
}
try {
long pid = Long.parseLong(pidArg);
if (pid != 0) {
singlePid = String.valueOf(pid);
}
} catch (NumberFormatException nfe) {
matchClass = pidArg;
}
}
private static String getExcludeStringFrom(Class<?> excludeClass) {
if (excludeClass == null) {
return "";
}
Module m = excludeClass.getModule();
if (m.isNamed()) {
return m.getName() + "/" + excludeClass.getName();
}
return excludeClass.getName();
}
private static boolean check(VirtualMachineDescriptor vmd, String excludeClass, String partialMatch) {
// Try to get the main class name using (platform specific) ProcessHelper
String mainClass = ProcessHelper.getMainClass(vmd.id());
// If the main class name could not be retrieved by ProcessHelper, get it with the attach mechanism
if (mainClass == null) {
try {
VmIdentifier vmId = new VmIdentifier(vmd.id());
MonitoredHost monitoredHost = MonitoredHost.getMonitoredHost(vmId);
MonitoredVm monitoredVm = monitoredHost.getMonitoredVm(vmId, -1);
mainClass = MonitoredVmUtil.mainClass(monitoredVm, true);
monitoredHost.detach(monitoredVm);
} catch (NullPointerException npe) {
// There is a potential race, where a running java app is being
// queried, unfortunately the java app has shutdown after this
// method is started but before getMonitoredVM is called.
// If this is the case, then the /tmp/hsperfdata_xxx/pid file
// will have disappeared and we will get a NullPointerException.
// Handle this gracefully....
return false;
} catch (MonitorException | URISyntaxException e) {
return false;
}
}
if (excludeClass != null && mainClass.equals(excludeClass)) {
return false;
}
if (partialMatch != null && mainClass.indexOf(partialMatch) == -1) {
return false;
}
return true;
}
private static Collection<VirtualMachineDescriptor> getSingleVMD(String pid) {
Collection<VirtualMachineDescriptor> vids = new ArrayList<>();
List<VirtualMachineDescriptor> vmds = VirtualMachine.list();
for (VirtualMachineDescriptor vmd : vmds) {
if (check(vmd, null, null)) {
if (pid.equals(vmd.id())) {
vids.add(vmd);
}
}
}
return vids;
}
private static Collection<VirtualMachineDescriptor> getVMDs(Class<?> excludeClass, String partialMatch) {
String excludeCls = getExcludeStringFrom(excludeClass);
Collection<VirtualMachineDescriptor> vids = new ArrayList<>();
List<VirtualMachineDescriptor> vmds = VirtualMachine.list();
for (VirtualMachineDescriptor vmd : vmds) {
if (check(vmd, excludeCls, partialMatch)) {
vids.add(vmd);
}
}
return vids;
}
public Collection<VirtualMachineDescriptor> getVirtualMachineDescriptors() {
if (singlePid != null) {
return getSingleVMD(singlePid);
} else {
return getVMDs(null, matchClass);
}
}
public Collection<String> getVirtualMachinePids(Class<?> excludeClass) {
if (singlePid != null) {
// There is a bug in AttachProvider, when VM is debuggee-suspended it's not listed by the AttachProvider.
// If we are talking about a specific pid, just return it.
return List.of(singlePid);
} else {
return getVMDs(excludeClass, matchClass).stream().map(x -> {return x.id();}).collect(Collectors.toList());
}
}
}
⏎ sun/tools/common/ProcessArgumentMatcher.java
Or download all of them as a single archive file:
File name: jdk.jcmd-17.0.5-src.zip File size: 51997 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jconsole.jmod - JConsole Tool
2023-08-17, ≈21🔥, 0💬
Popular Posts:
What Is commons-lang3-3.1.jar? commons-lang3-3.1.jar is the JAR file for Apache Commons Lang 3.1, wh...
JDK 11 jdk.crypto.cryptoki.jmod is the JMOD file for JDK 11 Crypto Cryptoki module. JDK 11 Crypto KI...
How to display XML element type information with the jaxp\TypeInfoWriter.java provided in the Apache...
Java Architecture for XML Binding (JAXB) is a Java API that allows Java developers to map Java class...
Java Servlet API 4.0.1 Source Code Files are important if you want to compile them with different JD...