|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwt.jmx.core.MBeanUtilities
public final class MBeanUtilities
Collection of various utilities used in conjunction with implementation
and use of JMX MBeans.
Supported API: true
Extendable: false
| Field Summary | |
|---|---|
static boolean |
CURRENT_THREAD_CPU_TIME_SUPPORTED
Value of THREAD_MBEAN.isCurrentThreadCpuTimeSupported(). |
static boolean |
NON_CURRENT_THREAD_CPU_TIME_SUPPORTED
Value of THREAD_MBEAN.isThreadCpuTimeSupported(). |
static RuntimeMXBean |
RUNTIME_MBEAN
Platform RuntimeMXBean (result of ManagementFactory.getRuntime())
Supported API: true |
static boolean |
THREAD_CONTENTION_MONITORING_SUPPORTED
Value of THREAD_MBEAN.isThreadContentionMonitoringSupported(). |
static ThreadMXBean |
THREAD_MBEAN
Platform ThreadMXBean (result of ManagementFactory.getThreadMXBean())
Supported API: true |
static long |
VM_START_TIME
Java virtual machine start time (result of RUNTIME_MBEAN.getStartTime()) Supported API: true |
| Method Summary | |
|---|---|
static MBeanInfo |
fixOpenMBeanAttrInfo(MBeanInfo origMBeanInfo,
Map<String,OpenType> attrNameToTypeMap)
Returns updated version of the MBeanInfo provided wherein the MBeanAttributeInfo for each attribute named in the given map is replaced by an OpenMBeanAttributeInfo that is identical except that corresponding OpenType from the map is specified as the return type. |
static String |
formatMessage(String messageFormat,
Object... formatArgs)
Localized (and simplified) replacement for WTMessage to
avoid this dependency in lower-level MBean code. |
static int |
getAvailableProcessors()
Returns the available number of processors. |
static String[] |
getFullStackTraceAsStringArray()
Get full stack trace (from THREAD_MBEAN) as an array of Strings. |
static long |
getMilliTimeFromNanoTime(long nanoTime)
Convert from a System.nanoTime() results to an approximate System.currentTimeMillis() result. |
static long |
getNanoTimeFromMilliTime(long milliTime)
Inverse operation of getMilliTimeFromNanoTime(). |
static long |
getNotificationSequenceNumber()
Get a (per instance of this class) unique sequence number specifically for use in giving ids to notifications. |
static long |
getProcessCpuTime()
Returns CPU time consumed by process since startup in nanosecond precision (but not necessarily nanosecond accuracy). |
static CompositeData[] |
getSortedData(TabularData tabularData)
Sorts the given TabularData's CompositeData by field specified as TabularData's indexing keys and returns the CompositeData objects as an array. |
static boolean |
isThreadCpuTimeEnabled()
Encapsulates calls to THREAD_MBEAN.isThreadCpuTimeEnabled(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ThreadMXBean THREAD_MBEAN
ManagementFactory.getThreadMXBean())
public static final RuntimeMXBean RUNTIME_MBEAN
ManagementFactory.getRuntime())
public static final long VM_START_TIME
public static final boolean CURRENT_THREAD_CPU_TIME_SUPPORTED
public static final boolean NON_CURRENT_THREAD_CPU_TIME_SUPPORTED
public static final boolean THREAD_CONTENTION_MONITORING_SUPPORTED
| Method Detail |
|---|
public static final long getNotificationSequenceNumber()
public static long getProcessCpuTime()
Note that this method assumes that the ManagementFactory.OPERATING_SYSTEM_MXBEAN_NAME
has an attribute named "ProcessCpuTime" containing this information, which
is the case in Sun JVMs. If such an attribute is not found, then this
method will simply return 0.
Supported API: true
public static int getAvailableProcessors()
public static String[] getFullStackTraceAsStringArray()
public static final String formatMessage(String messageFormat,
Object... formatArgs)
WTMessage to
avoid this dependency in lower-level MBean code. This routine should be
used instead of directly using MessageFormat to provide
easier handling of quote characters for localizers.
public static long getMilliTimeFromNanoTime(long nanoTime)
public static long getNanoTimeFromMilliTime(long milliTime)
public static CompositeData[] getSortedData(TabularData tabularData)
The CompositeData within a TabularData are naturally in hash order, so this utility
is necessary when a human-meaningful ordering is desired.
Supported API: true
public static MBeanInfo fixOpenMBeanAttrInfo(MBeanInfo origMBeanInfo,
Map<String,OpenType> attrNameToTypeMap)
This is the correct thing to do when for attributes returning TabularData
or CompositeData in that this allows JMX applications to programmatically
determine the precise data type that will be returned without / prior to
fetching a value. It seems that most JMX consoles do not require this
level of precision, however, so this is not strictly necessary.
Supported API: true
origMBeanInfo - Original MBeanInfo objectattrNameToTypeMap - Map from attribute names to corresponding OpenTypes
public static boolean isThreadCpuTimeEnabled()
One should check CURRENT_THREAD_CPU_TIME_SUPPORTED and/or
NON_CURRENT_THREAD_CPU_TIME_SUPPORTED prior to calling this method despite
its internal workaround to save the overhead of unnecessary exception
throws.
Supported API: true
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||