public class VirtualMachineDescriptor extends Object
A VirtualMachineDescriptor
is a container class used to describe a Java virtual machine. It encapsulates an identifier that identifies a target virtual machine, and a reference to the AttachProvider
that should be used when attempting to attach to the virtual machine. The identifier is implementation-dependent but is typically the process identifier (or pid) environments where each Java virtual machine runs in its own operating system process.
A VirtualMachineDescriptor
also has a displayName
. The display name is typically a human readable string that a tool might display to a user. For example, a tool that shows a list of Java virtual machines running on a system might use the display name rather than the identifier. A VirtualMachineDescriptor
may be created without a display name. In that case the identifier is used as the display name.
VirtualMachineDescriptor
instances are typically created by invoking the VirtualMachine.list()
method. This returns the complete list of descriptors to describe the Java virtual machines known to all installed attach providers
.
Constructor | Description |
---|---|
VirtualMachineDescriptor |
Creates a virtual machine descriptor from the given components. |
VirtualMachineDescriptor |
Creates a virtual machine descriptor from the given components. |
Modifier and Type | Method | Description |
---|---|---|
String |
displayName() |
Return the display name component of this descriptor. |
boolean |
equals |
Tests this VirtualMachineDescriptor for equality with another object. |
int |
hashCode() |
Returns a hash-code value for this VirtualMachineDescriptor. |
String |
id() |
Return the identifier component of this descriptor. |
AttachProvider |
provider() |
Return the AttachProvider that this descriptor references. |
String |
toString() |
Returns the string representation of the VirtualMachineDescriptor . |
public VirtualMachineDescriptor(AttachProvider provider, String id, String displayName)
provider
- The AttachProvider to attach to the Java virtual machine.id
- The virtual machine identifier.displayName
- The display name.NullPointerException
- If any of the arguments are null
public VirtualMachineDescriptor(AttachProvider provider, String id)
This convenience constructor works as if by invoking the three-argument constructor as follows:
new VirtualMachineDescriptor
(provider, id, id);
That is, it creates a virtual machine descriptor such that the display name is the same as the virtual machine identifier.
provider
- The AttachProvider to attach to the Java virtual machine.id
- The virtual machine identifier.NullPointerException
- If provider
or id
is null
.public AttachProvider provider()
AttachProvider
that this descriptor references.AttachProvider
that this descriptor references.public String id()
public String displayName()
public int hashCode()
Object.hashCode
method.public boolean equals(Object ob)
If the given object is not a VirtualMachineDescriptor then this method returns false
. For two VirtualMachineDescriptors to be considered equal requires that they both reference the same provider, and their identifiers
are equal.
This method satisfies the general contract of the Object.equals
method.
public String toString()
VirtualMachineDescriptor
.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.attach/com/sun/tools/attach/VirtualMachineDescriptor.html