Search in sources :

Example 56 with CompositeDataSupport

use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.

the class TestLockInfo method createGoodCompositeData.

/**
 * @return a new <code>CompositeData</code> instance representing a
 *         <code>LockInfo</code>.
 */
static CompositeData createGoodCompositeData() {
    CompositeData result = null;
    String[] names = { "className", "identityHashCode" };
    Object[] values = { /* className */
    new String(GOOD_CD_CLASSNAME), /* identityHashCode */
    new Integer(GOOD_CD_IDHASHCODE) };
    CompositeType cType = createGoodLockInfoCompositeType();
    try {
        result = new CompositeDataSupport(cType, names, values);
    } catch (OpenDataException e) {
        e.printStackTrace();
    }
    return result;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 57 with CompositeDataSupport

use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.

the class GcInfoUtil method toCompositeData.

/**
 * @param info the garbage collection information
 * @return a new {@link CompositeData} instance that represents the supplied <code>info</code> object
 */
public static CompositeData toCompositeData(GcInfo info) {
    CompositeData result = null;
    if (null != info) {
        CompositeType type = getCompositeType();
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
        String[] names = { "index", "startTime", "endTime", "usageBeforeGc", "usageAfterGc" };
        Object[] values = { Long.valueOf(info.getId()), Long.valueOf(info.getStartTime()), Long.valueOf(info.getEndTime()), MemoryUsageUtil.toTabularData(info.getMemoryUsageBeforeGc()), MemoryUsageUtil.toTabularData(info.getMemoryUsageAfterGc()) };
        try {
            result = new CompositeDataSupport(type, names, values);
        } catch (OpenDataException e) {
            if (ManagementUtils.VERBOSE_MODE) {
                e.printStackTrace(System.err);
            }
        }
    }
    return result;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 58 with CompositeDataSupport

use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.

the class GarbageCollectionNotificationInfoUtil method toCompositeData.

/**
 * @param info the garbage collection notification information
 * @return a new {@link CompositeData} instance that represents the supplied <code>info</code> object
 */
public static CompositeData toCompositeData(GarbageCollectionNotificationInfo info) {
    CompositeData result = null;
    if (info != null) {
        CompositeType type = getCompositeType();
        // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
        String[] names = { "gcName", "gcAction", "gcCause", "gcInfo" };
        Object[] values = { info.getGcName(), info.getGcAction(), info.getGcCause(), GcInfoUtil.toCompositeData(info.getGcInfo()) };
        try {
            result = new CompositeDataSupport(type, names, values);
        } catch (OpenDataException e) {
            if (ManagementUtils.VERBOSE_MODE) {
                e.printStackTrace(System.err);
            }
        }
    }
    return result;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 59 with CompositeDataSupport

use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.

the class TestThreadInfo method createGoodStackTraceCompositeData.

/**
 * @return new array of <code>CompositeData</code> representing an array
 *         of <code>StackTraceElement</code>.
 */
protected static CompositeData[] createGoodStackTraceCompositeData() {
    // Let's make the array have three elements. Doesn't matter that
    // they are all identical.
    CompositeData[] result = new CompositeData[3];
    CompositeType cType = createGoodStackTraceElementCompositeType();
    String[] names = TestMisc.getJava9STEMethodNames();
    Object[] values = { new String("foo.bar.Blobby"), new String("takeOverWorld"), new String("Blobby.java"), new Integer(2100), new Boolean(false), new String("myModuleName"), new String("myModuleVersion"), new String("myClassLoaderName") };
    for (int i = 0; i < result.length; i++) {
        try {
            result[i] = new CompositeDataSupport(cType, names, values);
        } catch (OpenDataException e) {
            e.printStackTrace();
        }
    }
    // end for
    return result;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 60 with CompositeDataSupport

use of javax.management.openmbean.CompositeDataSupport in project openj9 by eclipse.

the class TestThreadInfo method createGoodCompositeData.

/**
 * @return a new <code>CompositeData</code> instance representing a
 *         <code>ThreadInfo</code>.
 */
protected static CompositeData createGoodCompositeData() {
    CompositeData result = null;
    CompositeType cType = createGoodThreadInfoCompositeType();
    try {
        result = new CompositeDataSupport(cType, typeNamesGlobal, valuesCompositeDataGlobal);
    } catch (OpenDataException e) {
        e.printStackTrace();
    }
    return result;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Aggregations

CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)166 CompositeData (javax.management.openmbean.CompositeData)107 CompositeType (javax.management.openmbean.CompositeType)105 TabularDataSupport (javax.management.openmbean.TabularDataSupport)78 OpenDataException (javax.management.openmbean.OpenDataException)66 TabularData (javax.management.openmbean.TabularData)46 HashMap (java.util.HashMap)36 TabularType (javax.management.openmbean.TabularType)30 Map (java.util.Map)26 OpenType (javax.management.openmbean.OpenType)15 ObjectName (javax.management.ObjectName)12 MBeanServer (javax.management.MBeanServer)8 Test (org.junit.Test)8 IOException (java.io.IOException)7 EndpointUtilizationStatistics (org.apache.camel.spi.EndpointUtilizationStatistics)7 MBeanException (javax.management.MBeanException)6 JsonArray (javax.json.JsonArray)5 JsonObject (javax.json.JsonObject)5 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)5 ArrayList (java.util.ArrayList)4