Package org.jppf.management.diagnostics
Class Diagnostics
java.lang.Object
org.jppf.management.diagnostics.Diagnostics
- All Implemented Interfaces:
Closeable,AutoCloseable,DiagnosticsMBean
Implementation of the
DiagnosticsMBean interface.- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from interface org.jppf.management.diagnostics.DiagnosticsMBean
MBEAN_NAME_DRIVER, MBEAN_NAME_NODE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()cpuLoad()Get an approximation of the current CPU load.voidgc()Perform a full garbage collection.List<JPPFProperty<?>>Get the list of properties available as monitoring data.Determine whether a deadlock is detected in the JVM.Get a summarized snapshot of the JVM health.Get a a string representation of a JVM health snapshot.heapDump()Trigger a heap dump of the JVM.Get the current state of the heap and non-heap memory for the JVM.Get a full thread dump, including detection of deadlocks.String[]Get the names of all live threads in the current JVM.
-
Constructor Details
-
Diagnostics
Initialize this MBean implementation.- Parameters:
closeableType- the name of the type of closeable to use.
-
-
Method Details
-
memoryInformation
Description copied from interface:DiagnosticsMBeanGet the current state of the heap and non-heap memory for the JVM.- Specified by:
memoryInformationin interfaceDiagnosticsMBean- Returns:
- a
MemoryInformationinstance. - Throws:
Exception- if any error occurs.
-
gc
Description copied from interface:DiagnosticsMBeanPerform a full garbage collection. This method callsSystem.gc().- Specified by:
gcin interfaceDiagnosticsMBean- Throws:
Exception- if any error occurs.
-
threadNames
Description copied from interface:DiagnosticsMBeanGet the names of all live threads in the current JVM.- Specified by:
threadNamesin interfaceDiagnosticsMBean- Returns:
- an arrray of thread names as strings.
- Throws:
Exception- if any error occurs.
-
threadDump
Description copied from interface:DiagnosticsMBeanGet a full thread dump, including detection of deadlocks.- Specified by:
threadDumpin interfaceDiagnosticsMBean- Returns:
- a
ThreadDumpinstance. - Throws:
Exception- if any error occurs.
-
hasDeadlock
Description copied from interface:DiagnosticsMBeanDetermine whether a deadlock is detected in the JVM.- Specified by:
hasDeadlockin interfaceDiagnosticsMBean- Returns:
trueif a deadlock is detected,falseotherwise.- Throws:
Exception- if any error occurs.
-
healthSnapshot
Description copied from interface:DiagnosticsMBeanGet a summarized snapshot of the JVM health.- Specified by:
healthSnapshotin interfaceDiagnosticsMBean- Returns:
- a
HealthSnapshotinstance. - Throws:
Exception- if any error occurs.
-
healthSnapshotAsString
Description copied from interface:DiagnosticsMBeanGet a a string representation of a JVM health snapshot. The returned string contains a set of key / value pairs separated by new lines. As such, it can be loaded directly into aPropertiesorTypedPropertiesobject via theirload(Reader)method, using aStringReader.- Specified by:
healthSnapshotAsStringin interfaceDiagnosticsMBean- Returns:
- a
Properties-compatible string representation of a JVM health snapshot. - Throws:
Exception- if any error occurs.
-
heapDump
Description copied from interface:DiagnosticsMBeanTrigger a heap dump of the JVM. This will not work with all JVM implementations. It should work with Oracle standard and JRockit JVMs, along with IBM JVM.- Specified by:
heapDumpin interfaceDiagnosticsMBean- Returns:
- a message describing the outcome.
- Throws:
Exception- if any error occurs.
-
cpuLoad
Description copied from interface:DiagnosticsMBeanGet an approximation of the current CPU load. The computed value is equal tosumi(thread_used_cpui) / interval, for all the live threads of the JVM at the time of the computation. Thus, errors may occur, since many threads may have been created then died between two computations. However, in most cases this is a reasonable approximation, whose computation does not tax the CPU too heavily.- Specified by:
cpuLoadin interfaceDiagnosticsMBean- Returns:
- the cpu load as a double value in the range
[0, 1](ratio oftotalCpuTime / computationInterval), or -1d if CPU time measurement is not available for the JVM.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getMonitoringDataProperties
Description copied from interface:DiagnosticsMBeanGet the list of properties available as monitoring data.- Specified by:
getMonitoringDataPropertiesin interfaceDiagnosticsMBean- Returns:
- a list of the properties described as instances of
JPPFProperty.
-