Package com.reallifedeveloper.tools
Class FullThreadDump
java.lang.Object
com.reallifedeveloper.tools.FullThreadDump
This FullThreadDump class demonstrates the capability to get a full thread dump and also detect deadlock remotely.
Based on code by Sun Microsystems, Inc. and Oracle.
- Author:
- Josh Bloch, Neal Gafter, RealLifeDeveloper
-
Constructor Summary
ConstructorsConstructorDescriptionFullThreadDump
(String hostname, int port) Creates a newFullThreadDump
object that is connected to a JMX server on the given host and port.Creates a newFullThreadDump
object that is connected to a JMX server at the givenJMXServiceURL
. -
Method Summary
Modifier and TypeMethodDescriptiondump()
Creates a thread dump with information about all the threads running in the Java process being monitored by the JMX server connected to.static void
Connects to a JMX server at the given host and port number and creates a thread dump that is logged on INFO level.
-
Constructor Details
-
FullThreadDump
Creates a newFullThreadDump
object that is connected to a JMX server on the given host and port.- Parameters:
hostname
- the name of the host running the JMX serverport
- the port number the JMX server is listening on- Throws:
IOException
- if connection to the JMX server fails
-
FullThreadDump
Creates a newFullThreadDump
object that is connected to a JMX server at the givenJMXServiceURL
.- Parameters:
url
- theJMXServiceURL
of the JMX server- Throws:
IOException
- if connection to the JMX server fails
-
-
Method Details
-
dump
Creates a thread dump with information about all the threads running in the Java process being monitored by the JMX server connected to.The information is meant to be read by humans and is not easily parsable.
- Returns:
- a list of strings with information about the threads, e.g., thread name, call stack an so on.
- Throws:
IOException
- if communication with the JMX server fails
-
main
Connects to a JMX server at the given host and port number and creates a thread dump that is logged on INFO level.- Parameters:
args
- should be one string on the form "hostname:port", e.g., "localhost:4711"- Throws:
IOException
- if communication with the JMX server fails
-