com.ibm.lang.management

Class ManagementUtils

  1. java.lang.Object
  2. extended bycom.ibm.lang.management.ManagementUtils

  1. public class ManagementUtils
  2. extends java.lang.Object
Support methods for com.ibm.lang.management classes.

Field Summary

Modifier and Type Field and Description
  1. static
  2. boolean
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
  1. static
  2. <T>T
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.
  1. static
  2. <T>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.
  1. static
  2. java.util.List<java.lang.String>
convertStringArrayToList(java.lang.String[] data)
Convenience method to converts an array of String to a List<String>.
  1. static
  2. 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.
  1. static
  2. <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.
  1. static
  2. ClassLoadingMXBeanImpl
getClassLoadingBean()
  1. static
  2. java.lang.Class
getClassMaybePrimitive(java.lang.String name)
Convenience method that sets out to return the Classobject for the specified type named name.
  1. static
  2. CompilationMXBeanImpl
getCompliationBean()
  1. static
  2. java.util.List<java.lang.management.GarbageCollectorMXBean>
getGarbageCollectorMXBeans()
Returns a list of all of the instances of GarbageCollectorMXBean in this virtual machine.
  1. static
  2. javax.management.openmbean.CompositeType
getLockInfoCompositeType()
  1. static
  2. java.lang.management.LockInfo[]
getLockInfosFromCompositeDataArray(javax.management.openmbean.CompositeData[] lockInfosCDArray)
Returns an array of LockInfowhose elements have been created from the corresponding elements of the lockInfosCDArray argument.
  1. static
  2. LoggingMXBeanImpl
getLoggingBean()
  1. static
  2. MemoryMXBeanImpl
getMemoryBean()
  1. static
  2. java.util.List<java.lang.management.MemoryManagerMXBean>
getMemoryManagerMXBeans()
Returns a list of all of the instances of MemoryManagerMXBeanin this virtual machine.
  1. static
  2. java.util.List<java.lang.management.MemoryPoolMXBean>
getMemoryPoolMXBeans()
Returns a list of all of the instances of MemoryPoolMXBeanin this virtual machine.
  1. static
  2. javax.management.openmbean.CompositeType
getMemoryUsageCompositeType()
  1. static
  2. java.lang.management.MonitorInfo[]
getMonitorInfosFromCompositeDataArray(javax.management.openmbean.CompositeData[] monitorInfosCDArray)
Returns an array of MonitorInfowhose elements have been created from the corresponding elements of the monitorInfosCDArray argument.
  1. static
  2. OperatingSystemMXBeanImpl
getOperatingSystemBean()
  1. static
  2. RuntimeMXBeanImpl
getRuntimeBean()
  1. static
  2. java.lang.StackTraceElement
getStackTraceFromCompositeData(javax.management.openmbean.CompositeData stackTraceCD)
Convenience method that returns a StackTraceElementcreated from the corresponding CompositeData argument.
  1. static
  2. java.lang.StackTraceElement[]
getStackTracesFromCompositeDataArray(javax.management.openmbean.CompositeData[] stackTraceDataVal)
Returns an array of StackTraceElementwhose elements have been created from the corresponding elements of the stackTraceDataVal argument.
  1. static
  2. ThreadMXBeanImpl
getThreadBean()
  1. static
  2. javax.management.openmbean.CompositeType
getThreadInfoCompositeType()
  1. static
  2. <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.
  1. static
  2. 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.
  1. static
  2. javax.management.openmbean.CompositeData
toAvailableProcessorsNotificationInfoCompositeData(AvailableProcessorsNotificationInfo info)
  1. static
  2. javax.management.openmbean.CompositeData
toLockInfoCompositeData(java.lang.management.LockInfo info)
  1. static
  2. javax.management.openmbean.CompositeData
toMemoryNotificationInfoCompositeData(java.lang.management.MemoryNotificationInfo info)
  1. static
  2. javax.management.openmbean.CompositeData
toMemoryUsageCompositeData(java.lang.management.MemoryUsage usage)
  1. static
  2. javax.management.openmbean.CompositeData
toMonitorInfoCompositeData(java.lang.management.MonitorInfo info)
  1. static
  2. javax.management.openmbean.CompositeData
toProcessingCapacityNotificationInfoCompositeData(ProcessingCapacityNotificationInfo info)
  1. static
  2. javax.management.openmbean.CompositeData
toStackTraceElementCompositeData(java.lang.StackTraceElement element)
  1. static
  2. javax.management.openmbean.TabularData
toSystemPropertiesTabularData(java.util.Map<java.lang.String,java.lang.String> propsMap)
  1. static
  2. javax.management.openmbean.CompositeData
toThreadInfoCompositeData(java.lang.management.ThreadInfo info)
  1. static
  2. javax.management.openmbean.CompositeData
toTotalPhysicalMemoryNotificationInfoCompositeData(TotalPhysicalMemoryNotificationInfo info)
  1. static
  2. void
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.
  1. static
  2. void
verifyFieldNumber(javax.management.openmbean.CompositeData cd,int i)
Throws an IllegalArgumentExceptionif the CompositeDataargument cd does not have the number of attributes specified in i.
  1. static
  2. void
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

  1. 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

  1. public ManagementUtils()

Method Detail

getClassLoadingBean

  1. public static ClassLoadingMXBeanImpl getClassLoadingBean( )
Returns:
the singleton ClassLoadingMXBean instance.

getMemoryBean

  1. public static MemoryMXBeanImpl getMemoryBean( )
Returns:
the singleton MemoryMXBean instance.

getThreadBean

  1. public static ThreadMXBeanImpl getThreadBean( )
Returns:
the singleton ThreadMXBean instance.

getRuntimeBean

  1. public static RuntimeMXBeanImpl getRuntimeBean( )
Returns:
the singleton RuntimeMXBean instance.

getOperatingSystemBean

  1. public static OperatingSystemMXBeanImpl getOperatingSystemBean( )
Returns:
the singleton RuntimeMXBean instance.

getCompliationBean

  1. public static CompilationMXBeanImpl getCompliationBean( )
Returns:
the singleton CompilationMXBean if available.

getLoggingBean

  1. public static LoggingMXBeanImpl getLoggingBean( )
Returns:
the singleton LoggingMXBean instance.

getMemoryManagerMXBeans

  1. 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

  1. 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

  1. 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

  1. public static void verifyFieldTypes( javax.management.openmbean.CompositeData cd,
  2. java.lang.String[] expectedNames,
  3. 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

  1. public static void verifyFieldNames( javax.management.openmbean.CompositeData cd,
  2. 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

  1. public static void verifyFieldNumber( javax.management.openmbean.CompositeData cd,
  2. 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

  1. 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

  1. public static javax.management.openmbean.CompositeType getMemoryUsageCompositeType( )
Returns:
an instance of CompositeTypefor the MemoryUsage class.

toMemoryNotificationInfoCompositeData

  1. 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

  1. public static javax.management.openmbean.CompositeData toProcessingCapacityNotificationInfoCompositeData( ProcessingCapacityNotificationInfo info)
Parameters:
Returns:
a CompositeDataobject that represents the supplied info object.

toTotalPhysicalMemoryNotificationInfoCompositeData

  1. public static javax.management.openmbean.CompositeData toTotalPhysicalMemoryNotificationInfoCompositeData( TotalPhysicalMemoryNotificationInfo info)
Parameters:
Returns:
a CompositeDataobject that represents the supplied info object.

toAvailableProcessorsNotificationInfoCompositeData

  1. public static javax.management.openmbean.CompositeData toAvailableProcessorsNotificationInfoCompositeData( AvailableProcessorsNotificationInfo info)
Parameters:
Returns:
a CompositeDataobject that represents the supplied info object.

toThreadInfoCompositeData

  1. 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

  1. 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

  1. 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

  1. 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

  1. public static javax.management.openmbean.CompositeType getLockInfoCompositeType( )
Returns:
an instance of CompositeType for the LockInfo class

getThreadInfoCompositeType

  1. public static javax.management.openmbean.CompositeType getThreadInfoCompositeType( )
Returns:
an instance of CompositeType for the ThreadInfo class.

convertStringArrayToList

  1. 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

  1. 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

  1. public static <T> T convertFromCompositeData( javax.management.openmbean.CompositeData data,
  2. java.lang.Class<T> realClass)
  3. throws java.lang.SecurityException
  4. java.lang.NoSuchMethodException
  5. java.lang.IllegalArgumentException
  6. java.lang.IllegalAccessException
  7. 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.NoSuchMethodException
java.lang.SecurityException
java.lang.reflect.InvocationTargetException
java.lang.IllegalAccessException
java.lang.IllegalArgumentException

convertFromOpenType

  1. public static <T> T convertFromOpenType( java.lang.Object data,
  2. java.lang.Class<?> openClass,
  3. java.lang.Class<T> realClass)
  4. throws java.lang.ClassNotFoundException
  5. java.lang.InstantiationException
  6. java.lang.IllegalAccessException
  7. java.lang.SecurityException
  8. java.lang.IllegalArgumentException
  9. java.lang.NoSuchMethodException
  10. 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.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
java.lang.IllegalArgumentException
java.lang.SecurityException

convertToOpenType

  1. public static <T> T convertToOpenType( java.lang.Object data,
  2. java.lang.Class<T> openClass,
  3. 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

  1. 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

  1. public static java.lang.Class getClassMaybePrimitive( java.lang.String name)
  2. 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

  1. public static boolean isWrapperClass( java.lang.Class<? extends java.lang.Object> wrapper,
  2. 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

  1. 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

  1. 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

  1. 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

  1. 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)
The 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

  1. 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)