Class VirtualMachineDescriptor
- java.lang.Object
-
- com.sun.tools.attach.VirtualMachineDescriptor
-
public final class VirtualMachineDescriptor extends java.lang.Object
Describes a Java virtual machine.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 theAttachProvider
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 adisplayName
. 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. AVirtualMachineDescriptor
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 theVirtualMachine.list()
method. This returns the complete list of descriptors to describe the Java virtual machines known to all installedattach providers
.- Since:
- 1.6
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
displayName
private int
hash
private java.lang.String
id
private AttachProvider
provider
-
Constructor Summary
Constructors Constructor Description VirtualMachineDescriptor(AttachProvider provider, java.lang.String id)
Creates a virtual machine descriptor from the given components.VirtualMachineDescriptor(AttachProvider provider, java.lang.String id, java.lang.String displayName)
Creates a virtual machine descriptor from the given components.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
displayName()
Return the display name component of this descriptor.boolean
equals(java.lang.Object ob)
Tests this VirtualMachineDescriptor for equality with another object.int
hashCode()
Returns a hash-code value for this VirtualMachineDescriptor.java.lang.String
id()
Return the identifier component of this descriptor.AttachProvider
provider()
Return theAttachProvider
that this descriptor references.java.lang.String
toString()
Returns the string representation of theVirtualMachineDescriptor
.
-
-
-
Field Detail
-
provider
private AttachProvider provider
-
id
private java.lang.String id
-
displayName
private java.lang.String displayName
-
hash
private volatile int hash
-
-
Constructor Detail
-
VirtualMachineDescriptor
public VirtualMachineDescriptor(AttachProvider provider, java.lang.String id, java.lang.String displayName)
Creates a virtual machine descriptor from the given components.- Parameters:
provider
- The AttachProvider to attach to the Java virtual machine.id
- The virtual machine identifier.displayName
- The display name.- Throws:
java.lang.NullPointerException
- If any of the arguments arenull
-
VirtualMachineDescriptor
public VirtualMachineDescriptor(AttachProvider provider, java.lang.String id)
Creates a virtual machine descriptor from the given components.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.
- Parameters:
provider
- The AttachProvider to attach to the Java virtual machine.id
- The virtual machine identifier.- Throws:
java.lang.NullPointerException
- If provider or id is null.
-
-
Method Detail
-
provider
public AttachProvider provider()
Return theAttachProvider
that this descriptor references.- Returns:
- The
AttachProvider
that this descriptor references.
-
id
public java.lang.String id()
Return the identifier component of this descriptor.- Returns:
- The identifier component of this descriptor.
-
displayName
public java.lang.String displayName()
Return the display name component of this descriptor.- Returns:
- The display name component of this descriptor.
-
hashCode
public int hashCode()
Returns a hash-code value for this VirtualMachineDescriptor. The hash code is based upon the descriptor's components, and satisfies the general contract of the Object.hashCode method.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash-code value for this descriptor.
-
equals
public boolean equals(java.lang.Object ob)
Tests this VirtualMachineDescriptor for equality with another object.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 method.
- Overrides:
equals
in classjava.lang.Object
- Parameters:
ob
- The object to which this object is to be compared- Returns:
- true if, and only if, the given object is a VirtualMachineDescriptor that is equal to this VirtualMachineDescriptor.
-
toString
public java.lang.String toString()
Returns the string representation of theVirtualMachineDescriptor
.- Overrides:
toString
in classjava.lang.Object
-
-