
public abstract class HotSpotVirtualMachine extends VirtualMachine
| Modifier and Type | Method and Description |
|---|---|
InputStream |
dumpHeap(Object... args) |
InputStream |
executeJCmd(String command) |
Properties |
getAgentProperties()
Returns the current agent properties in the target virtual
machine.
|
Properties |
getSystemProperties()
Returns the current system properties in the target virtual machine.
|
InputStream |
heapHisto(Object... args) |
void |
loadAgent(String agent,
String options)
Loads an agent.
|
void |
loadAgentLibrary(String agentLibrary,
String options)
Loads an agent library.
|
void |
loadAgentPath(String agentLibrary,
String options)
Load a native agent library by full pathname.
|
void |
localDataDump() |
InputStream |
printFlag(String name) |
InputStream |
remoteDataDump(Object... args) |
InputStream |
setFlag(String name,
String value) |
String |
startLocalManagementAgent()
Starts the local JMX management agent in the target virtual machine.
|
void |
startManagementAgent(Properties agentProperties)
Starts the JMX management agent in the target virtual machine.
|
attach, attach, detach, equals, hashCode, id, list, loadAgent, loadAgentLibrary, loadAgentPath, provider, toStringpublic void loadAgentLibrary(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException
VirtualMachine A JVM
TI client is called an agent. It is developed in a native language.
A JVM TI agent is deployed in a platform specific manner but it is typically the
platform equivalent of a dynamic library. Alternatively, it may be statically linked into the VM.
This method causes the given agent library to be loaded into the target
VM (if not already loaded or if not statically linked into the VM).
It then causes the target VM to invoke the Agent_OnAttach function
or, for a statically linked agent named 'L', the Agent_OnAttach_L function
as specified in the
JVM Tools
Interface specification. Note that the Agent_OnAttach[_L]
function is invoked even if the agent library was loaded prior to invoking
this method.
The agent library provided is the name of the agent library. It is interpreted
in the target virtual machine in an implementation-dependent manner. Typically an
implementation will expand the library name into an operating system specific file
name. For example, on UNIX systems, the name L might be expanded to
libL.so, and located using the search path specified by the
LD_LIBRARY_PATH environment variable. If the agent named 'L' is
statically linked into the VM then the VM must export a function named
Agent_OnAttach_L.
If the Agent_OnAttach[_L] function in the agent library returns
an error then an AgentInitializationException is
thrown. The return value from the Agent_OnAttach[_L] can then be
obtained by invoking the returnValue
method on the exception.
loadAgentLibrary in class VirtualMachineagentLibrary - The name of the agent library.options - The options to provide to the Agent_OnAttach[_L]
function (can be null).AgentLoadException - If the agent library does not exist, the agent library is not
statically linked with the VM, or the agent library cannot be
loaded for another reason.AgentInitializationException - If the Agent_OnAttach[_L] function returns an error.IOException - If an I/O error occursAgentInitializationException.returnValue()public void loadAgentPath(String agentLibrary, String options) throws AgentLoadException, AgentInitializationException, IOException
VirtualMachine A JVM
TI client is called an agent. It is developed in a native language.
A JVM TI agent is deployed in a platform specific manner but it is typically the
platform equivalent of a dynamic library. Alternatively, the native
library specified by the agentPath parameter may be statically
linked with the VM. The parsing of the agentPath parameter into
a statically linked library name is done in a platform
specific manner in the VM. For example, in UNIX, an agentPath parameter
of /a/b/libL.so would name a library 'L'.
See the JVM TI Specification for more details.
This method causes the given agent library to be loaded into the target
VM (if not already loaded or if not statically linked into the VM).
It then causes the target VM to invoke the Agent_OnAttach
function or, for a statically linked agent named 'L', the
Agent_OnAttach_L function as specified in the
JVM Tools
Interface specification.
Note that the Agent_OnAttach[_L]
function is invoked even if the agent library was loaded prior to invoking
this method.
The agent library provided is the absolute path from which to load the
agent library. Unlike loadAgentLibrary, the library name
is not expanded in the target virtual machine.
If the Agent_OnAttach[_L] function in the agent library returns
an error then an AgentInitializationException is
thrown. The return value from the Agent_OnAttach[_L] can then be
obtained by invoking the returnValue
method on the exception.
loadAgentPath in class VirtualMachineagentLibrary - The full path of the agent library.options - The options to provide to the Agent_OnAttach[_L]
function (can be null).AgentLoadException - If the agent library does not exist, the agent library is not
statically linked with the VM, or the agent library cannot be
loaded for another reason.AgentInitializationException - If the Agent_OnAttach[_L] function returns an error.IOException - If an I/O error occursAgentInitializationException.returnValue()public void loadAgent(String agent, String options) throws AgentLoadException, AgentInitializationException, IOException
VirtualMachine The agent provided to this method is a path name to a JAR file on the file
system of the target virtual machine. This path is passed to the target virtual
machine where it is interpreted. The target virtual machine attempts to start
the agent as specified by the java.lang.instrument specification.
That is, the specified JAR file is added to the system class path (of the target
virtual machine), and the agentmain method of the agent class, specified
by the Agent-Class attribute in the JAR manifest, is invoked. This
method completes when the agentmain method completes.
loadAgent in class VirtualMachineagent - Path to the JAR file containing the agent.options - The options to provide to the agent's agentmain
method (can be null).AgentLoadException - If the agent does not exist, or cannot be started in the manner
specified in the java.lang.instrument specification.AgentInitializationException - If the agentmain throws an exceptionIOException - If an I/O error occurspublic Properties getSystemProperties() throws IOException
VirtualMachine This method returns the system properties in the target virtual
machine. Properties whose key or value is not a String are
omitted. The method is approximately equivalent to the invocation of the
method System.getProperties
in the target virtual machine except that properties with a key or
value that is not a String are not included.
This method is typically used to decide which agent to load into
the target virtual machine with loadAgent, or
loadAgentLibrary. For example, the
java.home or user.dir properties might be
use to create the path to the agent library or JAR file.
getSystemProperties in class VirtualMachineAttachOperationFailedException - If the target virtual machine is unable to complete the
attach operation. A more specific error message will be
given by Throwable.getMessage().IOException - If an I/O error occurs, a communication error for example,
that cannot be identified as an error to indicate that the
operation failed in the target VM.System.getProperties(),
VirtualMachine.loadAgentLibrary(java.lang.String, java.lang.String),
VirtualMachine.loadAgent(java.lang.String, java.lang.String)public Properties getAgentProperties() throws IOException
VirtualMachineThe target virtual machine can maintain a list of properties on behalf of agents. The manner in which this is done, the names of the properties, and the types of values that are allowed, is implementation specific. Agent properties are typically used to store communication end-points and other agent configuration details. For example, a debugger agent might create an agent property for its transport address.
This method returns the agent properties whose key and value is a String. Properties whose key or value is not a String are omitted. If there are no agent properties maintained in the target virtual machine then an empty property list is returned.
getAgentProperties in class VirtualMachineAttachOperationFailedException - If the target virtual machine is unable to complete the
attach operation. A more specific error message will be
given by Throwable.getMessage().IOException - If an I/O error occurs, a communication error for example,
that cannot be identified as an error to indicate that the
operation failed in the target VM.public void startManagementAgent(Properties agentProperties) throws IOException
VirtualMachine The configuration properties are the same as those specified on
the command line when starting the JMX management agent. In the same
way as on the command line, you need to specify at least the
com.sun.management.jmxremote.port property.
See the online documentation for Monitoring and Management Using JMX Technology for further details.
startManagementAgent in class VirtualMachineagentProperties - A Properties object containing the configuration properties
for the agent.AttachOperationFailedException - If the target virtual machine is unable to complete the
attach operation. A more specific error message will be
given by Throwable.getMessage().IOException - If an I/O error occurs, a communication error for example,
that cannot be identified as an error to indicate that the
operation failed in the target VM.public String startLocalManagementAgent() throws IOException
VirtualMachineSee the online documentation for Monitoring and Management Using JMX Technology for further details.
startLocalManagementAgent in class VirtualMachineJMXServiceURL.JMXServiceURL(String)
constructor.AttachOperationFailedException - If the target virtual machine is unable to complete the
attach operation. A more specific error message will be
given by Throwable.getMessage().IOException - If an I/O error occurs, a communication error for example,
that cannot be identified as an error to indicate that the
operation failed in the target VM.public void localDataDump()
throws IOException
IOExceptionpublic InputStream remoteDataDump(Object... args) throws IOException
IOExceptionpublic InputStream dumpHeap(Object... args) throws IOException
IOExceptionpublic InputStream heapHisto(Object... args) throws IOException
IOExceptionpublic InputStream setFlag(String name, String value) throws IOException
IOExceptionpublic InputStream printFlag(String name) throws IOException
IOExceptionpublic InputStream executeJCmd(String command) throws IOException
IOExceptionCopyright © 2017–2018 earcam. All rights reserved.