public abstract class HotSpotVirtualMachine extends VirtualMachine
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
dumpHeap(java.lang.Object... args) |
java.io.InputStream |
executeJCmd(java.lang.String command) |
java.util.Properties |
getAgentProperties()
Returns the current agent properties in the target virtual
machine.
|
java.util.Properties |
getSystemProperties()
Returns the current system properties in the target virtual machine.
|
java.io.InputStream |
heapHisto(java.lang.Object... args) |
void |
loadAgent(java.lang.String agent,
java.lang.String options)
Loads an agent.
|
void |
loadAgentLibrary(java.lang.String agentLibrary,
java.lang.String options)
Loads an agent library.
|
void |
loadAgentPath(java.lang.String agentLibrary,
java.lang.String options)
Load a native agent library by full pathname.
|
void |
localDataDump() |
java.io.InputStream |
printFlag(java.lang.String name) |
java.io.InputStream |
remoteDataDump(java.lang.Object... args) |
java.io.InputStream |
setFlag(java.lang.String name,
java.lang.String value) |
attach, attach, detach, equals, hashCode, id, list, loadAgent, loadAgentLibrary, loadAgentPath, provider, toString
public void loadAgentLibrary(java.lang.String agentLibrary, java.lang.String options) throws AgentLoadException, AgentInitializationException, java.io.IOException
VirtualMachine
Agent_OnAttach
function
as specified in the
JVM Tools
Interface specification. Note that the Agent_OnAttach
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 foo might be expanded to
libfoo.so, and located using the search path specified by the
LD_LIBRARY_PATH environment variable.
If the Agent_OnAttach
function in the agent library returns
an error then an AgentInitializationException
is
thrown. The return value from the Agent_OnAttach
can then be
obtained by invoking the returnValue
method on the exception.loadAgentLibrary
in class VirtualMachine
agentLibrary
- The name of the agent library.options
- The options to provide to the Agent_OnAttach
function (can be null
).AgentLoadException
- If the agent library does not exist, or cannot be loaded for
another reason.AgentInitializationException
- If the Agent_OnAttach
function returns an errorjava.io.IOException
- If an I/O error occursAgentInitializationException.returnValue()
public void loadAgentPath(java.lang.String agentLibrary, java.lang.String options) throws AgentLoadException, AgentInitializationException, java.io.IOException
VirtualMachine
Agent_OnAttach
function
as specified in the
JVM Tools
Interface specification. Note that the Agent_OnAttach
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
function in the agent library returns
an error then an AgentInitializationException
is
thrown. The return value from the Agent_OnAttach
can then be
obtained by invoking the returnValue
method on the exception.loadAgentPath
in class VirtualMachine
agentLibrary
- The full path of the agent library.options
- The options to provide to the Agent_OnAttach
function (can be null
).AgentLoadException
- If the agent library does not exist, or cannot be loaded for
another reason.AgentInitializationException
- If the Agent_OnAttach
function returns an errorjava.io.IOException
- If an I/O error occursAgentInitializationException.returnValue()
public void loadAgent(java.lang.String agent, java.lang.String options) throws AgentLoadException, AgentInitializationException, java.io.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 VirtualMachine
agent
- 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 exceptionjava.io.IOException
- If an I/O error occurspublic java.util.Properties getSystemProperties() throws java.io.IOException
VirtualMachine
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 VirtualMachine
java.io.IOException
- If an I/O error occursSystem.getProperties()
,
VirtualMachine.loadAgentLibrary(java.lang.String, java.lang.String)
,
VirtualMachine.loadAgent(java.lang.String, java.lang.String)
public java.util.Properties getAgentProperties() throws java.io.IOException
VirtualMachine
getAgentProperties
in class VirtualMachine
java.io.IOException
- If an I/O error occurspublic void localDataDump() throws java.io.IOException
java.io.IOException
public java.io.InputStream remoteDataDump(java.lang.Object... args) throws java.io.IOException
java.io.IOException
public java.io.InputStream dumpHeap(java.lang.Object... args) throws java.io.IOException
java.io.IOException
public java.io.InputStream heapHisto(java.lang.Object... args) throws java.io.IOException
java.io.IOException
public java.io.InputStream setFlag(java.lang.String name, java.lang.String value) throws java.io.IOException
java.io.IOException
public java.io.InputStream printFlag(java.lang.String name) throws java.io.IOException
java.io.IOException
public java.io.InputStream executeJCmd(java.lang.String command) throws java.io.IOException
java.io.IOException