blob: 1571fb865960a6e0b0afae7f2b6813931def5bb0 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001FullThreadDump demonstrates the use of the java.lang.management API
2to print the full thread dump. JDK 6 defines a new API to dump
3the information about monitors and java.util.concurrent ownable
4synchronizers.
5
6This demo also illustrates how to monitor JDK 5 and JDK 6 VMs with
7two versions of APIs.
8
9It contains two parts:
10a) Local monitoring within the application
11b) Remote monitoring by connecting to a JMX agent with a JMX service URL:
12 service:jmx:rmi:///jndi/rmi://<hostName>:<portNum>/jmxrmi
13 where <hostName> is the hostname and <portNum> is the port number
14 to which the JMX agent will be connected.
15
16To run the demo
17---------------
18a) Local Monitoring
19
20 java -cp <JDK_HOME>/demo/management/FullThreadDump/FullThreadDump.jar Deadlock
21
22 This will dump the stack trace and then detect deadlocks locally
23 within the application.
24
25b) Remote Monitoring
26
27 (1) Start the Deadlock application (or any other application)
28 with the JMX agent as follows:
29
30 java -Dcom.sun.management.jmxremote.port=1090
31 -Dcom.sun.management.jmxremote.ssl=false
32 -Dcom.sun.management.jmxremote.authenticate=false
33 -cp <JDK_HOME>/demo/management/FullThreadDump/FullThreadDump.jar
34 Deadlock
35
36 This instruction uses the Sun's built-in support to enable a JMX agent.
37 You can programmatically start a JMX agent with the RMI connector
38 using javax.management.remote API. See the javadoc and examples for
39 javax.management.remote API for details.
40
41 (2) Run FullThreadDump
42
43 java -jar <JDK_HOME>/demo/management/FullThreadDump/FullThreadDump.jar \
44 localhost:1090
45
46 This will dump the stack trace and then print out the deadlocked threads.
47
48These instructions assume that this installation's version of the java
49command is in your path. If it isn't, then you should either
50specify the complete path to the java command or update your
51PATH environment variable as described in the installation
52instructions for the Java(TM) SDK.