The java.lang.management
package provides the management interface for monitoring and management of the JVM and the operating system. Specifically it covers interfaces for the following systems:
Class loading
Compilation
Garbage collection
Memory manager
Runtime
Threads
The JDK includes example code that demonstrates the usage of the java.lang.management
package. These examples can be found in the $JAVA_HOME/demo/management
directory. Some of these example codes are as follows:
MemoryMonitor
demonstrates the use of the java.lang.management
API to observe the memory usage of all memory pools consumed by the application.
FullThreadDump
demonstrates the use of the java.lang.management
API to get a full thread dump and detect deadlocks programmatically.
VerboseGC
demonstrates the use of the java.lang.management
API to print the garbage collection statistics and memory usage of an application.
In addition to the java.lang.management
package, the JDK release includes platform extensions in the com.sun.management
package. The platform extensions include a management interface to obtain detailed statistics from garbage collectors that perform collections in cycles. These extensions also include a management interface to obtain additional memory statistics from the operating system.
For more information about the platform extensions, see the Java SE Monitoring and Management documentation.