use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.
the class MemoryNotificationInfoUtil method toCompositeData.
/**
* @param info a {@link java.lang.management.MemoryNotificationInfo} object
* @return a {@link CompositeData} object that represents the supplied <code>info</code> object
*/
public static CompositeData toCompositeData(MemoryNotificationInfo info) {
CompositeData result = null;
if (info != null) {
CompositeType type = getCompositeType();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
String[] names = { "poolName", "usage", "count" };
Object[] values = { info.getPoolName(), MemoryUsageUtil.toCompositeData(info.getUsage()), Long.valueOf(info.getCount()) };
try {
result = new CompositeDataSupport(type, names, values);
} catch (OpenDataException e) {
if (ManagementUtils.VERBOSE_MODE) {
e.printStackTrace(System.err);
}
}
}
return result;
}
use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.
the class MemoryUsageUtil method toCompositeData.
/**
* @param usage a {@link MemoryUsage} object
* @return a {@link CompositeData} object that represents the supplied <code>usage</code> object
*/
public static CompositeData toCompositeData(MemoryUsage usage) {
CompositeData result = null;
if (usage != null) {
CompositeType type = getCompositeType();
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
String[] names = { "init", "used", "committed", "max" };
Object[] values = { Long.valueOf(usage.getInit()), Long.valueOf(usage.getUsed()), Long.valueOf(usage.getCommitted()), Long.valueOf(usage.getMax()) };
try {
result = new CompositeDataSupport(type, names, values);
} catch (OpenDataException e) {
if (ManagementUtils.VERBOSE_MODE) {
e.printStackTrace(System.err);
}
}
}
return result;
}
use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.
the class MemoryUsageUtil method toTabularData.
/**
* @param map a set of named {@link MemoryUsage} objects
* @return a {@link TabularData} object that represents the supplied map
*/
public static TabularData toTabularData(Map<String, MemoryUsage> map) {
TabularData table = null;
if (null != map) {
CompositeType type = getTabularRowType();
// $NON-NLS-1$ //$NON-NLS-2$
String[] names = { "key", "value" };
table = new TabularDataSupport(getTabularType());
for (Entry<String, MemoryUsage> entry : map.entrySet()) {
Object[] values = { entry.getKey(), toCompositeData(entry.getValue()) };
CompositeData row = null;
try {
row = new CompositeDataSupport(type, names, values);
} catch (OpenDataException e) {
if (ManagementUtils.VERBOSE_MODE) {
e.printStackTrace(System.err);
}
}
table.put(row);
}
}
return table;
}
use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.
the class ManagementUtils method toSystemPropertiesTabularData.
/**
* @param propsMap
* a <code>Map<String, String%gt;</code> of the system
* properties.
* @return the system properties (e.g. as obtained from
* {@link RuntimeMXBean#getSystemProperties()}) wrapped in a
* {@link TabularData}.
*/
public static TabularData toSystemPropertiesTabularData(Map<String, String> propsMap) {
// Bail out early on null input.
if (propsMap == null) {
return null;
}
TabularData result = null;
try {
// Obtain the row type for the TabularType
// $NON-NLS-1$ //$NON-NLS-2$
String[] rtItemNames = { "key", "value" };
// $NON-NLS-1$ //$NON-NLS-2$
String[] rtItemDescs = { "key", "value" };
OpenType<?>[] rtItemTypes = { SimpleType.STRING, SimpleType.STRING };
CompositeType rowType = new CompositeType(propsMap.getClass().getName(), propsMap.getClass().getName(), rtItemNames, rtItemDescs, rtItemTypes);
// Obtain the required TabularType
TabularType sysPropsType = new TabularType(propsMap.getClass().getName(), propsMap.getClass().getName(), rowType, // $NON-NLS-1$
new String[] { "key" });
// Create an empty TabularData
result = new TabularDataSupport(sysPropsType);
// instance of CompositeData and put into the TabularType
for (Entry<String, String> entry : propsMap.entrySet()) {
String propKey = entry.getKey();
String propVal = entry.getValue();
result.put(new CompositeDataSupport(rowType, rtItemNames, new String[] { propKey, propVal }));
}
} catch (OpenDataException e) {
if (ManagementUtils.VERBOSE_MODE) {
e.printStackTrace(System.err);
}
result = null;
}
return result;
}
use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.
the class MonitorInfoUtil method toCompositeData.
/**
* @param info a <code>MonitorInfo</code> object
* @return a new <code>CompositeData</code> instance that represents the supplied <code>info</code> object
*/
public static CompositeData toCompositeData(MonitorInfo info) {
CompositeData result = null;
if (info != null) {
CompositeType type = getCompositeType();
String[] names = { // $NON-NLS-1$ //$NON-NLS-2$
"className", // $NON-NLS-1$ //$NON-NLS-2$
"identityHashCode", "lockedStackFrame", // $NON-NLS-1$ //$NON-NLS-2$
"lockedStackDepth" };
Object[] values = { info.getClassName(), Integer.valueOf(info.getIdentityHashCode()), StackTraceElementUtil.toCompositeData(info.getLockedStackFrame()), Integer.valueOf(info.getLockedStackDepth()) };
try {
result = new CompositeDataSupport(type, names, values);
} catch (OpenDataException e) {
if (ManagementUtils.VERBOSE_MODE) {
e.printStackTrace(System.err);
}
}
}
return result;
}
Aggregations