com.ibm.lang.management
Class ManagementUtils
- java.lang.Object
com.ibm.lang.management.ManagementUtils
- public class ManagementUtils
- extends java.lang.Object
Field Summary
| Modifier and Type | Field and Description |
|---|---|
|
VERBOSE_MODE
System property setting used to decide if non-fatal exceptions should be
written out to console.
|
Constructor Summary
| Constructor and Description |
|---|
ManagementUtils()
|
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
convertFromCompositeData(javax.management.openmbean.CompositeData data,java.lang.Class<T> realClass)
Return a new instance of type
T from the supplied CompositeDataobject whose type maps to T.
|
|
convertFromOpenType(java.lang.Object data,java.lang.Class<?> openClass,java.lang.Class<T> realClass)
Receive data of the type specified in
openClass and return
it in an instance of the type specified in realClass.
|
|
convertStringArrayToList(java.lang.String[] data)
Convenience method to converts an array of
String to a
List<String>.
|
|
convertTabularDataToMap(javax.management.openmbean.TabularData data)
Receives an instance of a
TabularDatawhose data is wrapping a
Map and returns a new instance of Map
containing the input information.
|
|
convertToOpenType(java.lang.Object data,java.lang.Class<T> openClass,java.lang.Class<?> realClass)
Convenience method to convert an object,
data from its
Java type realClass to the specified open MBean type
openClass.
|
|
getClassLoadingBean()
|
|
getClassMaybePrimitive(java.lang.String name)
Convenience method that sets out to return the
Classobject for
the specified type named name.
|
|
getCompliationBean()
|
|
getGarbageCollectorMXBeans()
Returns a list of all of the instances of
GarbageCollectorMXBean
in this virtual machine.
|
|
getLockInfoCompositeType()
|
|
getLockInfosFromCompositeDataArray(javax.management.openmbean.CompositeData[] lockInfosCDArray)
Returns an array of
LockInfowhose elements have been created
from the corresponding elements of the lockInfosCDArray
argument.
|
|
getLoggingBean()
|
|
getMemoryBean()
|
|
getMemoryManagerMXBeans()
Returns a list of all of the instances of
MemoryManagerMXBeanin
this virtual machine.
|
|
getMemoryPoolMXBeans()
Returns a list of all of the instances of
MemoryPoolMXBeanin
this virtual machine.
|
|
getMemoryUsageCompositeType()
|
|
getMonitorInfosFromCompositeDataArray(javax.management.openmbean.CompositeData[] monitorInfosCDArray)
Returns an array of
MonitorInfowhose elements have been created
from the corresponding elements of the monitorInfosCDArray
argument.
|
|
getOperatingSystemBean()
|
|
getRuntimeBean()
|
|
getStackTraceFromCompositeData(javax.management.openmbean.CompositeData stackTraceCD)
Convenience method that returns a
StackTraceElementcreated from
the corresponding CompositeData argument.
|
|
getStackTracesFromCompositeDataArray(javax.management.openmbean.CompositeData[] stackTraceDataVal)
Returns an array of
StackTraceElementwhose elements have been
created from the corresponding elements of the
stackTraceDataVal argument.
|
|
getThreadBean()
|
|
getThreadInfoCompositeType()
|
|
isANotificationEmitter(java.lang.Class<T> mxbeanInterface)
Convenience method that returns a boolean indication of whether or not
concrete instances of the the supplied interface type
mxbeanInterface should also be implementors of the
interface javax.management.NotificationEmitter.
|
|
isWrapperClass(java.lang.Class<? extends java.lang.Object> wrapper,java.lang.Class primitive)
Convenience method to determine if the
wrapper
Class
object is really the wrapper class for the
primitive Class object.
|
|
toAvailableProcessorsNotificationInfoCompositeData(AvailableProcessorsNotificationInfo info)
|
|
toLockInfoCompositeData(java.lang.management.LockInfo info)
|
|
toMemoryNotificationInfoCompositeData(java.lang.management.MemoryNotificationInfo info)
|
|
toMemoryUsageCompositeData(java.lang.management.MemoryUsage usage)
|
|
toMonitorInfoCompositeData(java.lang.management.MonitorInfo info)
|
|
toProcessingCapacityNotificationInfoCompositeData(ProcessingCapacityNotificationInfo info)
|
|
toStackTraceElementCompositeData(java.lang.StackTraceElement element)
|
|
toSystemPropertiesTabularData(java.util.Map<java.lang.String,java.lang.String> propsMap)
|
|
toThreadInfoCompositeData(java.lang.management.ThreadInfo info)
|
|
toTotalPhysicalMemoryNotificationInfoCompositeData(TotalPhysicalMemoryNotificationInfo info)
|
|
verifyFieldNames(javax.management.openmbean.CompositeData cd,java.lang.String[] expected)
Throws an
IllegalArgumentExceptionif the CompositeDataargument cd does not have any of the attributes named in
the expected array of strings.
|
|
verifyFieldNumber(javax.management.openmbean.CompositeData cd,int i)
Throws an
IllegalArgumentExceptionif the CompositeDataargument cd does not have the number of attributes
specified in i.
|
|
verifyFieldTypes(javax.management.openmbean.CompositeData cd,java.lang.String[] expectedNames,java.lang.String[] expectedTypes)
Throws an
IllegalArgumentExceptionif the CompositeDataargument cd contains attributes that are not of the exact
types specified in the expectedTypes argument.
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail
VERBOSE_MODE
- public static final boolean VERBOSE_MODE
System property setting used to decide if non-fatal exceptions should be
written out to console.
Constructor Detail
ManagementUtils
- public ManagementUtils()
Method Detail
getClassLoadingBean
- public static ClassLoadingMXBeanImpl getClassLoadingBean( )
Returns:
the singleton
ClassLoadingMXBean instance. getMemoryBean
- public static MemoryMXBeanImpl getMemoryBean( )
Returns:
the singleton
MemoryMXBean instance. getThreadBean
- public static ThreadMXBeanImpl getThreadBean( )
Returns:
the singleton
ThreadMXBean instance. getRuntimeBean
- public static RuntimeMXBeanImpl getRuntimeBean( )
Returns:
the singleton
RuntimeMXBean instance. getOperatingSystemBean
- public static OperatingSystemMXBeanImpl getOperatingSystemBean( )
Returns:
the singleton
RuntimeMXBean instance. getCompliationBean
- public static CompilationMXBeanImpl getCompliationBean( )
Returns:
the singleton
CompilationMXBean if available. getLoggingBean
- public static LoggingMXBeanImpl getLoggingBean( )
Returns:
the singleton
LoggingMXBean instance. getMemoryManagerMXBeans
- public static java.util.List<java.lang.management.MemoryManagerMXBean> getMemoryManagerMXBeans( )
Returns a list of all of the instances of
MemoryManagerMXBeanin
this virtual machine. Owing to the dynamic nature of this kind of
MXBean, it is possible that instances may be created or
destroyed between the invocation and return of this method.
Returns:
a list of all known
MemoryManagerMXBean s in this
virtual machine. getMemoryPoolMXBeans
- public static java.util.List<java.lang.management.MemoryPoolMXBean> getMemoryPoolMXBeans( )
Returns a list of all of the instances of
MemoryPoolMXBeanin
this virtual machine. Owing to the dynamic nature of this kind of
MXBean, it is possible that instances may be created or
destroyed between the invocation and return of this method.
Returns:
a list of all known
MemoryPoolMXBean s in this
virtual machine. getGarbageCollectorMXBeans
- public static java.util.List<java.lang.management.GarbageCollectorMXBean> getGarbageCollectorMXBeans( )
Returns a list of all of the instances of
GarbageCollectorMXBean
in this virtual machine. Owing to the dynamic nature of this kind of
MXBean, it is possible that instances may be created or
destroyed between the invocation and return of this method.
Returns:
a list of all known
GarbageCollectorMXBean s in
this virtual machine. verifyFieldTypes
- public static void verifyFieldTypes( javax.management.openmbean.CompositeData cd,
- java.lang.String[] expectedNames,
- java.lang.String[] expectedTypes)
Throws an
IllegalArgumentExceptionif the CompositeData
argument cd contains attributes that are not of the exact
types specified in the expectedTypes argument. The
attribute types of cd must also match the order of types
in expectedTypes.
Parameters:
cd - a CompositeData object expectedNames - an array of expected attribute names expectedTypes - an array of type names verifyFieldNames
- public static void verifyFieldNames( javax.management.openmbean.CompositeData cd,
- java.lang.String[] expected)
Throws an
IllegalArgumentExceptionif the CompositeData
argument cd does not have any of the attributes named in
the expected array of strings.
Parameters:
cd - a CompositeData object expected - an array of attribute names expected in cd. verifyFieldNumber
- public static void verifyFieldNumber( javax.management.openmbean.CompositeData cd,
- int i)
Throws an
IllegalArgumentExceptionif the CompositeData
argument cd does not have the number of attributes
specified in i.
Parameters:
cd - a CompositeData object i - the number of expected attributes in cd toMemoryUsageCompositeData
- public static javax.management.openmbean.CompositeData toMemoryUsageCompositeData( java.lang.management.MemoryUsage usage)
Parameters:
usage - a MemoryUsageobject. Returns:
a
CompositeDataobject that represents the supplied
usage object. getMemoryUsageCompositeType
- public static javax.management.openmbean.CompositeType getMemoryUsageCompositeType( )
Returns:
an instance of
CompositeTypefor the MemoryUsage
class. toMemoryNotificationInfoCompositeData
- public static javax.management.openmbean.CompositeData toMemoryNotificationInfoCompositeData( java.lang.management.MemoryNotificationInfo info)
Parameters:
info - a MemoryNotificationInfoobject. Returns:
a
CompositeDataobject that represents the supplied
info object. toProcessingCapacityNotificationInfoCompositeData
- public static javax.management.openmbean.CompositeData toProcessingCapacityNotificationInfoCompositeData( ProcessingCapacityNotificationInfo info)
Parameters:
info - a ProcessingCapacityNotificationInfo object. Returns:
a
CompositeDataobject that represents the supplied
info object. toTotalPhysicalMemoryNotificationInfoCompositeData
- public static javax.management.openmbean.CompositeData toTotalPhysicalMemoryNotificationInfoCompositeData( TotalPhysicalMemoryNotificationInfo info)
Parameters:
info - a TotalPhysicalMemoryNotificationInfo object. Returns:
a
CompositeDataobject that represents the supplied
info object. toAvailableProcessorsNotificationInfoCompositeData
- public static javax.management.openmbean.CompositeData toAvailableProcessorsNotificationInfoCompositeData( AvailableProcessorsNotificationInfo info)
Parameters:
info - a AvailableProcessorsNotificationInfo object. Returns:
a
CompositeDataobject that represents the supplied
info object. toThreadInfoCompositeData
- public static javax.management.openmbean.CompositeData toThreadInfoCompositeData( java.lang.management.ThreadInfo info)
Parameters:
info - a ThreadInfoobject. Returns:
a
CompositeDataobject that represents the supplied
info object. toMonitorInfoCompositeData
- public static javax.management.openmbean.CompositeData toMonitorInfoCompositeData( java.lang.management.MonitorInfo info)
Parameters:
info - a MonitorInfo object Returns:
a new
CompositeData instance that represents the
supplied info object. toLockInfoCompositeData
- public static javax.management.openmbean.CompositeData toLockInfoCompositeData( java.lang.management.LockInfo info)
Parameters:
info - a LockInfo object Returns:
a new
CompositeData instance that represents the
supplied info object. toStackTraceElementCompositeData
- public static javax.management.openmbean.CompositeData toStackTraceElementCompositeData( java.lang.StackTraceElement element)
Parameters:
element - a StackTraceElementobject. Returns:
a
CompositeDataobject that represents the supplied
element object. getLockInfoCompositeType
- public static javax.management.openmbean.CompositeType getLockInfoCompositeType( )
Returns:
an instance of
CompositeType for the LockInfo
class getThreadInfoCompositeType
- public static javax.management.openmbean.CompositeType getThreadInfoCompositeType( )
Returns:
an instance of
CompositeType for the ThreadInfo
class. convertStringArrayToList
- public static java.util.List<java.lang.String> convertStringArrayToList( java.lang.String[] data)
Convenience method to converts an array of
String to a
List<String>.
Parameters:
data - an array of String Returns:
a new
List<String> convertTabularDataToMap
- public static java.lang.Object convertTabularDataToMap( javax.management.openmbean.TabularData data)
Receives an instance of a
TabularDatawhose data is wrapping a
Map and returns a new instance of Map
containing the input information.
Parameters:
data - an instance of TabularData that may be mapped
to a Map. Returns:
a new
Mapcontaining the information originally wrapped
in the data input. Throws:
java.lang.IllegalArgumentException - if data has a CompositeType
that does not contain exactly two items (i.e. a key and a
value). convertFromCompositeData
- public static <T> T convertFromCompositeData( javax.management.openmbean.CompositeData data,
- java.lang.Class<T> realClass)
- throws java.lang.SecurityException
- java.lang.NoSuchMethodException
- java.lang.IllegalArgumentException
- java.lang.IllegalAccessException
- java.lang.reflect.InvocationTargetException
Return a new instance of type
T from the supplied
CompositeData object whose type maps to T.
Type Parameters:
T - the type of object wrapped by the CompositeData. Parameters:
data - an instance of CompositeData that maps to an
instance of T realClass - the Class object for type T Returns:
a new instance of
T Throws:
java.lang.NoSuchMethodExceptionjava.lang.SecurityExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.IllegalAccessExceptionjava.lang.IllegalArgumentExceptionconvertFromOpenType
- public static <T> T convertFromOpenType( java.lang.Object data,
- java.lang.Class<?> openClass,
- java.lang.Class<T> realClass)
- throws java.lang.ClassNotFoundException
- java.lang.InstantiationException
- java.lang.IllegalAccessException
- java.lang.SecurityException
- java.lang.IllegalArgumentException
- java.lang.NoSuchMethodException
- java.lang.reflect.InvocationTargetException
Receive data of the type specified in
openClass and return
it in an instance of the type specified in realClass.
Type Parameters:
T - Parameters:
data - an instance of the type named openTypeName openClass - realClass - Returns:
a new instance of the type
realTypeName containing
all the state in the input data object. Throws:
java.lang.ClassNotFoundExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionjava.lang.reflect.InvocationTargetExceptionjava.lang.NoSuchMethodExceptionjava.lang.IllegalArgumentExceptionjava.lang.SecurityExceptionconvertToOpenType
- public static <T> T convertToOpenType( java.lang.Object data,
- java.lang.Class<T> openClass,
- java.lang.Class<?> realClass)
Convenience method to convert an object,
data from its
Java type realClass to the specified open MBean type
openClass.
Type Parameters:
T - the open MBean class Parameters:
data - the object to be converted openClass - the open MBean class realClass - the real Java type of data Returns:
a new instance of type
openClass toSystemPropertiesTabularData
- public static javax.management.openmbean.TabularData toSystemPropertiesTabularData( java.util.Map<java.lang.String,java.lang.String> propsMap)
Parameters:
propsMap - a Map<String, String%gt; of the system
properties. Returns:
the system properties (e.g. as obtained from
RuntimeMXBean.getSystemProperties()) wrapped in a
TabularData. getClassMaybePrimitive
- public static java.lang.Class getClassMaybePrimitive( java.lang.String name)
- throws java.lang.ClassNotFoundException
Convenience method that sets out to return the
Classobject for
the specified type named name. Unlike the
Class.forName(java.lang.String)method, this will work even for
primitive types.
Parameters:
name - the name of a Java type Returns:
the
Class object for the type name Throws:
java.lang.ClassNotFoundException - if name does not correspond to any known type
(including primitive types). isWrapperClass
- public static boolean isWrapperClass( java.lang.Class<? extends java.lang.Object> wrapper,
- java.lang.Class primitive)
Convenience method to determine if the
wrapper
Class
object is really the wrapper class for the
primitive Class object.
Parameters:
wrapper - primitive - Returns:
true if the wrapper class is the
wrapper class for primitive. Otherwise
false. isANotificationEmitter
- public static <T> boolean isANotificationEmitter( java.lang.Class<T> mxbeanInterface)
Convenience method that returns a boolean indication of whether or not
concrete instances of the the supplied interface type
mxbeanInterface should also be implementors of the
interface javax.management.NotificationEmitter.
Type Parameters:
T - Parameters:
mxbeanInterface - Returns:
true if instances of type
mxbeanInterface should also implement
javax.management.NotificationEmitter. Otherwise,
false. getStackTracesFromCompositeDataArray
- public static java.lang.StackTraceElement[] getStackTracesFromCompositeDataArray( javax.management.openmbean.CompositeData[] stackTraceDataVal)
Returns an array of
StackTraceElement whose elements have been
created from the corresponding elements of the
stackTraceDataVal argument.
Parameters:
stackTraceDataVal - an array of CompositeDataobjects, each one
representing a StackTraceElement. Returns:
an array of
StackTraceElement objects built using
the data discovered in the corresponding elements of
stackTraceDataVal. Throws:
java.lang.IllegalArgumentException - if any of the elements of stackTraceDataVal do
not correspond to a StackTraceElement with the
following attributes:
className(java.lang.String)methodName(java.lang.String)fileName(java.lang.String)lineNumbercode> (java.lang.Integer)nativeMethod(java.lang.Boolean)
getLockInfosFromCompositeDataArray
- public static java.lang.management.LockInfo[] getLockInfosFromCompositeDataArray( javax.management.openmbean.CompositeData[] lockInfosCDArray)
Returns an array of
LockInfo whose elements have been created
from the corresponding elements of the lockInfosCDArray
argument.
Parameters:
lockInfosCDArray - an array of CompositeDataobjects, each one
representing a LockInfo. Returns:
an array of
LockInfo objects built using the data
discovered in the corresponding elements of
lockInfosCDArray. Throws:
java.lang.IllegalArgumentException - if any of the elements of lockInfosCDArray do
not correspond to a LockInfo with the
following attributes:
className(java.lang.String)identityHashCode(java.lang.Integer)
getMonitorInfosFromCompositeDataArray
- public static java.lang.management.MonitorInfo[] getMonitorInfosFromCompositeDataArray( javax.management.openmbean.CompositeData[] monitorInfosCDArray)
Returns an array of
MonitorInfo whose elements have been created
from the corresponding elements of the monitorInfosCDArray
argument.
Parameters:
monitorInfosCDArray - an array of CompositeDataobjects, each one
representing a MonitorInfo. Returns:
an array of
MonitorInfo objects built using the
data discovered in the corresponding elements of
monitorInfosCDArray. Throws:
java.lang.IllegalArgumentException - if any of the elements of monitorInfosCDArray
do not correspond to a MonitorInfo with the
following attributes:
lockedStackFrame(javax.management.openmbean.CompositeData)lockedStackDepth(java.lang.Integer)
lockedStackFrame attribute must correspond
to a java.lang.StackTraceElement which has the
following attributes:
className(java.lang.String)methodName(java.lang.String)fileName(java.lang.String)lineNumber(java.lang.Integer)nativeMethod(java.lang.Boolean)
getStackTraceFromCompositeData
- public static java.lang.StackTraceElement getStackTraceFromCompositeData( javax.management.openmbean.CompositeData stackTraceCD)
Convenience method that returns a
StackTraceElement created from
the corresponding CompositeData argument.
Parameters:
stackTraceCD - a CompositeData that wraps a
StackTraceElement Returns:
a
StackTraceElement object built using the data
discovered in the stackTraceCD. Throws:
java.lang.IllegalArgumentException - if the stackTraceCD does not correspond to a
StackTraceElement with the following
attributes:
className(java.lang.String)methodName(java.lang.String)fileName(java.lang.String)lineNumbercode> (java.lang.Integer)nativeMethod(java.lang.Boolean)