Java Code Examples for java.lang.management.MemoryNotificationInfo#from()

The following examples show how to use java.lang.management.MemoryNotificationInfo#from() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryNotifInfoCompositeData.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 2
Source File: MemoryNotifInfoCompositeData.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 3
Source File: MemoryNotifInfoCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 4
Source File: MemoryNotifInfoCompositeData.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 5
Source File: MemoryNotifInfoCompositeData.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 6
Source File: MemoryNotifInfoCompositeData.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 7
Source File: MemoryNotifInfoCompositeData.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
public static void badNameCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          badItemNames,
                          badItemNames,
                          validItemTypes);
    CompositeData cd =
        new CompositeDataSupport(ct,
                                 badItemNames,
                                 values);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 8
Source File: MemoryNotifInfoCompositeData.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 9
Source File: MemoryNotifInfoCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 10
Source File: MemoryNotifInfoCompositeData.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 11
Source File: MemoryNotifInfoCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 12
Source File: MemoryNotifInfoCompositeData.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 13
Source File: MemoryNotifInfoCompositeData.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 14
Source File: MemoryNotifInfoCompositeData.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void badTypeCompositeData() throws Exception {
    CompositeType ct =
        new CompositeType("MyCompositeType",
                          "CompositeType for MemoryNotificationInfo",
                          validItemNames,
                          validItemNames,
                          badItemTypes);

    final Object[] values1 = {
        "Dummy",
        "Foo",
        new Long(100),
        "Bad memory usage object",
        "Dummy",
    };

    CompositeData cd =
        new CompositeDataSupport(ct,
                                 validItemNames,
                                 values1);

    try {
        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
    } catch (IllegalArgumentException e) {
        System.out.println("Expected exception: " +
            e.getMessage());
        return;
    }
    throw new RuntimeException(
        "IllegalArgumentException not thrown");
}
 
Example 15
Source File: MemoryNotifInfoCompositeData.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 16
Source File: MemoryNotifInfoCompositeData.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 17
Source File: MemoryNotifInfoCompositeData.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 18
Source File: MemoryNotifInfoCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 19
Source File: MemoryNotifInfoCompositeData.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }
 
Example 20
Source File: MemoryNotifInfoCompositeData.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
public static void createGoodCompositeData() throws Exception {

        // get the CompositeType for MemoryUsage
        validItemTypes[USAGE] = OpenTypeConverter.toOpenType(MemoryUsage.class);
        CompositeType ct =
            new CompositeType("MyCompositeType",
                              "CompositeType for MemoryNotificationInfo",
                              validItemNames,
                              validItemNames,
                              validItemTypes);
        CompositeData cd =
            new CompositeDataSupport(ct,
                                     validItemNames,
                                     values);

        MemoryNotificationInfo info = MemoryNotificationInfo.from(cd);
        if (!info.getPoolName().equals(values[POOL_NAME])) {
            throw new RuntimeException("pool name = " + info.getPoolName() +
               " expected = " + values[POOL_NAME]);
        }
        if (info.getCount() != ((Long) values[COUNT]).longValue()) {
            throw new RuntimeException("count = " + info.getCount() +
               " expected = " + values[COUNT]);
        }
        if (info.getUsage().getInit() != 0) {
            throw new RuntimeException("usage init = " +
               info.getUsage().getInit() +
               " expected = 0");
        }
        if (info.getUsage().getUsed() != 100) {
            throw new RuntimeException("usage used = " +
               info.getUsage().getUsed() +
               " expected = 100");
        }
        if (info.getUsage().getCommitted () != 1000) {
            throw new RuntimeException("usage committed = " +
               info.getUsage().getCommitted() +
               " expected = 1000");
        }
        if (info.getUsage().getMax() != 5000) {
            throw new RuntimeException("usage max = " +
               info.getUsage().getMax() +
               " expected = 5000");
        }
        System.out.print("Pool name = " + info.getPoolName());
        System.out.println(" Count = " + info.getCount());
        System.out.println("Usage = " + info.getUsage());
    }