Class MonitoringManagementExamples
java.lang.Object
net.jrodolfo.java_evolution.java06.monitoring_management.MonitoringManagementExamples
Demonstrates platform MXBean monitoring APIs improved around Java 6.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImmutable snapshot of runtime monitoring values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReads the current live-thread count.intReads how many classes are currently loaded in this JVM.Reads descriptive runtime information for the current JVM.snapshot()Combines several MXBean readings into a compact operational snapshot.doubleReads the system load average added to the management API in Java 6.longReads a heap-memory snapshot.
-
Constructor Details
-
MonitoringManagementExamples
public MonitoringManagementExamples()
-
-
Method Details
-
runtimeName
Reads descriptive runtime information for the current JVM.- Returns:
- JVM runtime name
-
loadedClassCount
public int loadedClassCount()Reads how many classes are currently loaded in this JVM.- Returns:
- currently loaded class count
-
usedHeapBytes
public long usedHeapBytes()Reads a heap-memory snapshot.- Returns:
- used heap memory in bytes
-
liveThreadCount
public int liveThreadCount()Reads the current live-thread count.- Returns:
- live thread count
-
systemLoadAverage
public double systemLoadAverage()Reads the system load average added to the management API in Java 6. A negative value means the operating system does not provide this reading.- Returns:
- system load average, or a negative value when unavailable
-
snapshot
Combines several MXBean readings into a compact operational snapshot.- Returns:
- JVM snapshot
-