Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/demo/management/FullThreadDump/README.txt
38829 views
FullThreadDump demonstrates the use of the java.lang.management API1to print the full thread dump. JDK 6 defines a new API to dump2the information about monitors and java.util.concurrent ownable3synchronizers.45This demo also illustrates how to monitor JDK 5 and JDK 6 VMs with6two versions of APIs.78It contains two parts:9a) Local monitoring within the application10b) Remote monitoring by connecting to a JMX agent with a JMX service URL:11service:jmx:rmi:///jndi/rmi://<hostName>:<portNum>/jmxrmi12where <hostName> is the hostname and <portNum> is the port number13to which the JMX agent will be connected.1415To run the demo16---------------17a) Local Monitoring1819java -cp <JDK_HOME>/demo/management/FullThreadDump/FullThreadDump.jar Deadlock2021This will dump the stack trace and then detect deadlocks locally22within the application.2324b) Remote Monitoring2526(1) Start the Deadlock application (or any other application)27with the JMX agent as follows:2829java -Dcom.sun.management.jmxremote.port=109030-Dcom.sun.management.jmxremote.ssl=false31-Dcom.sun.management.jmxremote.authenticate=false32-cp <JDK_HOME>/demo/management/FullThreadDump/FullThreadDump.jar33Deadlock3435This instruction uses the Sun's built-in support to enable a JMX agent.36You can programmatically start a JMX agent with the RMI connector37using javax.management.remote API. See the javadoc and examples for38javax.management.remote API for details.3940(2) Run FullThreadDump4142java -jar <JDK_HOME>/demo/management/FullThreadDump/FullThreadDump.jar \43localhost:10904445This will dump the stack trace and then print out the deadlocked threads.4647These instructions assume that this installation's version of the java48command is in your path. If it isn't, then you should either49specify the complete path to the java command or update your50PATH environment variable as described in the installation51instructions for the Java(TM) SDK.525354