57 * #loadAgent loadAgent} method is used to load agents that are written in the Java |
57 * #loadAgent loadAgent} method is used to load agents that are written in the Java |
58 * Language and deployed in a {@link java.util.jar.JarFile JAR file}. (See |
58 * Language and deployed in a {@link java.util.jar.JarFile JAR file}. (See |
59 * {@link java.lang.instrument} for a detailed description on how these agents |
59 * {@link java.lang.instrument} for a detailed description on how these agents |
60 * are loaded and started). The {@link #loadAgentLibrary loadAgentLibrary} and |
60 * are loaded and started). The {@link #loadAgentLibrary loadAgentLibrary} and |
61 * {@link #loadAgentPath loadAgentPath} methods are used to load agents that |
61 * {@link #loadAgentPath loadAgentPath} methods are used to load agents that |
62 * are deployed either in a dynamic library or statically linked into the VM and make use of the <a |
62 * are deployed either in a dynamic library or statically linked into the VM and |
63 * href="../../../../../../../../technotes/guides/jvmti/index.html">JVM Tools |
63 * make use of the <a href="{@docRoot}/../specs/jvmti.html">JVM Tools Interface</a>. |
64 * Interface</a>. </p> |
64 * </p> |
65 * |
65 * |
66 * <p> In addition to loading agents a VirtualMachine provides read access to the |
66 * <p> In addition to loading agents a VirtualMachine provides read access to the |
67 * {@link java.lang.System#getProperties() system properties} in the target VM. |
67 * {@link java.lang.System#getProperties() system properties} in the target VM. |
68 * This can be useful in some environments where properties such as |
68 * This can be useful in some environments where properties such as |
69 * {@code java.home}, {@code os.name}, or {@code os.arch} are |
69 * {@code java.home}, {@code os.name}, or {@code os.arch} are |
287 } |
287 } |
288 |
288 |
289 /** |
289 /** |
290 * Loads an agent library. |
290 * Loads an agent library. |
291 * |
291 * |
292 * <p> A <a href="../../../../../../../../technotes/guides/jvmti/index.html">JVM |
292 * <p> A <a href="{@docRoot}/../specs/jvmti.html">JVM TI</a> |
293 * TI</a> client is called an <i>agent</i>. It is developed in a native language. |
293 * client is called an <i>agent</i>. It is developed in a native language. |
294 * A JVM TI agent is deployed in a platform specific manner but it is typically the |
294 * A JVM TI agent is deployed in a platform specific manner but it is typically the |
295 * platform equivalent of a dynamic library. Alternatively, it may be statically linked into the VM. |
295 * platform equivalent of a dynamic library. Alternatively, it may be statically linked into the VM. |
296 * This method causes the given agent library to be loaded into the target |
296 * This method causes the given agent library to be loaded into the target |
297 * VM (if not already loaded or if not statically linked into the VM). |
297 * VM (if not already loaded or if not statically linked into the VM). |
298 * It then causes the target VM to invoke the {@code Agent_OnAttach} function |
298 * It then causes the target VM to invoke the {@code Agent_OnAttach} function |
299 * or, for a statically linked agent named 'L', the {@code Agent_OnAttach_L} function |
299 * or, for a statically linked agent named 'L', the {@code Agent_OnAttach_L} function |
300 * as specified in the |
300 * as specified in the |
301 * <a href="../../../../../../../../technotes/guides/jvmti/index.html"> JVM Tools |
301 * <a href="{@docRoot}/../specs/jvmti.html">JVM Tools Interface</a> specification. |
302 * Interface</a> specification. Note that the {@code Agent_OnAttach[_L]} |
302 * Note that the {@code Agent_OnAttach[_L]} |
303 * function is invoked even if the agent library was loaded prior to invoking |
303 * function is invoked even if the agent library was loaded prior to invoking |
304 * this method. |
304 * this method. |
305 * |
305 * |
306 * <p> The agent library provided is the name of the agent library. It is interpreted |
306 * <p> The agent library provided is the name of the agent library. It is interpreted |
307 * in the target virtual machine in an implementation-dependent manner. Typically an |
307 * in the target virtual machine in an implementation-dependent manner. Typically an |
378 } |
378 } |
379 |
379 |
380 /** |
380 /** |
381 * Load a native agent library by full pathname. |
381 * Load a native agent library by full pathname. |
382 * |
382 * |
383 * <p> A <a href="../../../../../../../../technotes/guides/jvmti/index.html">JVM |
383 * <p> A <a href="{@docRoot}/../specs/jvmti.html">JVM TI</a> |
384 * TI</a> client is called an <i>agent</i>. It is developed in a native language. |
384 * client is called an <i>agent</i>. It is developed in a native language. |
385 * A JVM TI agent is deployed in a platform specific manner but it is typically the |
385 * A JVM TI agent is deployed in a platform specific manner but it is typically the |
386 * platform equivalent of a dynamic library. Alternatively, the native |
386 * platform equivalent of a dynamic library. Alternatively, the native |
387 * library specified by the agentPath parameter may be statically |
387 * library specified by the agentPath parameter may be statically |
388 * linked with the VM. The parsing of the agentPath parameter into |
388 * linked with the VM. The parsing of the agentPath parameter into |
389 * a statically linked library name is done in a platform |
389 * a statically linked library name is done in a platform |
395 * This method causes the given agent library to be loaded into the target |
395 * This method causes the given agent library to be loaded into the target |
396 * VM (if not already loaded or if not statically linked into the VM). |
396 * VM (if not already loaded or if not statically linked into the VM). |
397 * It then causes the target VM to invoke the {@code Agent_OnAttach} |
397 * It then causes the target VM to invoke the {@code Agent_OnAttach} |
398 * function or, for a statically linked agent named 'L', the |
398 * function or, for a statically linked agent named 'L', the |
399 * {@code Agent_OnAttach_L} function as specified in the |
399 * {@code Agent_OnAttach_L} function as specified in the |
400 * <a href="../../../../../../../../technotes/guides/jvmti/index.html"> JVM Tools |
400 * <a href="{@docRoot}/../specs/jvmti.html">JVM Tools Interface</a> specification. |
401 * Interface</a> specification. |
|
402 * Note that the {@code Agent_OnAttach[_L]} |
401 * Note that the {@code Agent_OnAttach[_L]} |
403 * function is invoked even if the agent library was loaded prior to invoking |
402 * function is invoked even if the agent library was loaded prior to invoking |
404 * this method. |
403 * this method. |
405 * |
404 * |
406 * <p> The agent library provided is the absolute path from which to load the |
405 * <p> The agent library provided is the absolute path from which to load the |
609 * <p> The configuration properties are the same as those specified on |
608 * <p> The configuration properties are the same as those specified on |
610 * the command line when starting the JMX management agent. In the same |
609 * the command line when starting the JMX management agent. In the same |
611 * way as on the command line, you need to specify at least the |
610 * way as on the command line, you need to specify at least the |
612 * {@code com.sun.management.jmxremote.port} property. |
611 * {@code com.sun.management.jmxremote.port} property. |
613 * |
612 * |
614 * <p> See the online documentation for <a |
613 * <p> See the online documentation for |
615 * href="../../../../../../../../technotes/guides/management/agent.html"> |
614 * {@extLink monitoring_and_management_using_jmx_technology |
616 * Monitoring and Management Using JMX Technology</a> for further details. |
615 * Monitoring and Management Using JMX Technology} for further details. |
617 * |
616 * |
618 * @param agentProperties |
617 * @param agentProperties |
619 * A Properties object containing the configuration properties |
618 * A Properties object containing the configuration properties |
620 * for the agent. |
619 * for the agent. |
621 * |
620 * |
640 public abstract void startManagementAgent(Properties agentProperties) throws IOException; |
639 public abstract void startManagementAgent(Properties agentProperties) throws IOException; |
641 |
640 |
642 /** |
641 /** |
643 * Starts the local JMX management agent in the target virtual machine. |
642 * Starts the local JMX management agent in the target virtual machine. |
644 * |
643 * |
645 * <p> See the online documentation for <a |
644 * <p> See the online documentation for |
646 * href="../../../../../../../../technotes/guides/management/agent.html"> |
645 * {@extLink monitoring_and_management_using_jmx_technology |
647 * Monitoring and Management Using JMX Technology</a> for further details. |
646 * Monitoring and Management Using JMX Technology} for further details. |
648 * |
647 * |
649 * @return The String representation of the local connector's service address. |
648 * @return The String representation of the local connector's service address. |
650 * The value can be parsed by the |
649 * The value can be parsed by the |
651 * {@link javax.management.remote.JMXServiceURL#JMXServiceURL(String)} |
650 * {@link javax.management.remote.JMXServiceURL#JMXServiceURL(String)} |
652 * constructor. |
651 * constructor. |