An attach provider is a concrete subclass of this class that has a zero-argument constructor and implements the abstract methods specified below.
An attach provider implementation is typically tied to a Java virtual machine implementation, version, or even mode of operation. That is, a specific provider implementation will typically only be capable of attaching to a specific Java virtual machine implementation or version. For example, Sun's JDK implementation ships with provider implementations that can only attach to Sun's HotSpot virtual machine. In general, if an environment consists of Java virtual machines of different versions and from different vendors then there will be an attach provider implementation for each family of implementations or versions.
An attach provider is identified by its name and type . The name is typically, but not required to be, a name that corresponds to the VM vendor. The Sun JDK implementation, for example, ships with attach providers that use the name "sun". The type typically corresponds to the attach mechanism. For example, an implementation that uses the Doors inter-process communication mechanism might use the type "doors". The purpose of the name and type is to identify providers in environments where there are multiple providers installed.
AttachProvider implementations are loaded and instantiated at the first invocation of the providers method. This method attempts to load all provider implementations that are installed on the platform.
All of the methods in this class are safe for use by multiple concurrent threads.
|Method from com.sun.tools.attach.spi.AttachProvider Summary:|
|attachVirtualMachine, attachVirtualMachine, listVirtualMachines, name, providers, type|
|Methods from java.lang.Object:|
|clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait|
|Method from com.sun.tools.attach.spi.AttachProvider Detail:|
abstract public VirtualMachine attachVirtualMachine(String id) throws AttachNotSupportedException, IOException
A Java virtual machine is identified by an abstract identifier. The nature of this identifier is platform dependent but in many cases it will be the string representation of the process identifier (or pid).
This method parses the identifier and maps the identifier to a Java
virtual machine (in an implementation dependent manner). If the identifier
cannot be parsed by the provider then an AttachNotSupportedException
is thrown. Once parsed this method attempts to attach to the Java virtual machine.
If the provider detects that the identifier corresponds to a Java virtual machine
that does not exist, or it corresponds to a Java virtual machine that does not support
the attach mechanism implemented by this provider, or it detects that the
Java virtual machine is a version to which this provider cannot attach, then
abstract public List<VirtualMachineDescriptor> listVirtualMachines()
This method returns a list of com.sun.tools.attach.VirtualMachineDescriptor elements. Each
public static List<AttachProvider> providers()
An AttachProvider is installed on the platform if:
The format of the provider configuration file is one fully-qualified class name per line. Space and tab characters surrounding each class name, as well as blank lines are ignored. The comment character is '#' (0x23), and on each line all characters following the first comment character are ignored. The file must be encoded in UTF-8.
AttachProvider implementations are loaded and instantiated (using the zero-arg constructor) at the first invocation of this method. The list returned by the first invocation of this method is the list of providers. Subsequent invocations of this method return a list of the same providers. The list is unmodifable.