jdk.management.jfr.SettingDescriptorInfo Java Examples

The following examples show how to use jdk.management.jfr.SettingDescriptorInfo. 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: FlightRecorderMXBeanProvider.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static FlightRecorderMXBean getFlightRecorderMXBean() {
    FlightRecorderMXBean bean = flightRecorderMXBean;
    if (bean == null) {
        SettingDescriptorInfo.from(null); // Sets flightRecorderMXBeanFactory under <clinit> lock
        synchronized (flightRecorderMXBeanFactory) {
            bean = flightRecorderMXBean;
            if (bean != null) {
                return bean;
            }
            try {
                bean = flightRecorderMXBean = flightRecorderMXBeanFactory.call();
            } catch (Exception e) {
                ManagementSupport.logError("Could not create Flight Recorder "
                        + "instance for MBeanServer. " + e.getMessage());
            }
        }
    }
    return bean;
}
 
Example #2
Source File: FlightRecorderMXBeanProvider.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static FlightRecorderMXBean getFlightRecorderMXBean() {
    FlightRecorderMXBean bean = flightRecorderMXBean;
    if (bean == null) {
        SettingDescriptorInfo.from(null); // Sets flightRecorderMXBeanFactory under <clinit> lock
        synchronized (flightRecorderMXBeanFactory) {
            bean = flightRecorderMXBean;
            if (bean != null) {
                return bean;
            }
            try {
                bean = flightRecorderMXBean = flightRecorderMXBeanFactory.call();
            } catch (Exception e) {
                ManagementSupport.logError("Could not create Flight Recorder "
                        + "instance for MBeanServer. " + e.getMessage());
            }
        }
    }
    return bean;
}
 
Example #3
Source File: TestEventTypes.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void verifyMyEventType(List<EventTypeInfo> infos) {
    for (EventTypeInfo info : infos) {
        if ("MyEvent.name".equals(info.getName())) {
            System.out.println("EventTypeInfo for MyEvent: " + info);
            Asserts.assertEquals("MyEvent.label", info.getLabel());
            Asserts.assertEquals("MyEvent.description", info.getDescription());
            for (SettingDescriptorInfo si : info.getSettingDescriptors()) {
                System.out.println("si=" + si);
            }
            return;
        }
    }
    Asserts.fail("Missing EventTypeInfo for MyEvent");
}
 
Example #4
Source File: TestEventTypes.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void assertSame(EventTypeInfo ti, EventType t) {
    try {
        Asserts.assertEquals(ti.getId(), t.getId(), "Wrong id");
        Asserts.assertEquals(ti.getName(), t.getName(), "Wrong name");
        Asserts.assertEquals(ti.getLabel(), t.getLabel(), "Wrong label");
        Asserts.assertEquals(ti.getDescription(), t.getDescription(), "Wrong description");
        Asserts.assertEquals(ti.getCategoryNames(), t.getCategoryNames(), "Wrong category names");

        for (SettingDescriptorInfo si : ti.getSettingDescriptors()) {
            String settingName = si.getName();
            boolean isFound = false;
            for (SettingDescriptor d : t.getSettingDescriptors()) {
                if (settingName.equals(d.getName())) {
                    assertSame(si, d, t);
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                Asserts.fail("No ValueDescriptor for SettingDescriptorInfo: " + si);
            }
        }
    } catch (Exception e) {
        System.out.printf("EventTypeInfo != EventType%nEventTypeInfo=%s%nEventType=%s%n", ti, t);
        throw e;
    }
}
 
Example #5
Source File: TestEventTypes.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void assertSame(SettingDescriptorInfo si, SettingDescriptor d, EventType type) {
    try {
        Asserts.assertEquals(si.getName(), d.getName(), "Wrong name");
        Asserts.assertEquals(si.getLabel(), d.getLabel(), "Wrong label");
        Asserts.assertEquals(si.getTypeName(), d.getTypeName(), "Wrong typeName");
        Asserts.assertEquals(si.getDescription(), d.getDescription(), "Wrong description");
        String typeDefaultValue = Events.getSetting(type, si.getName()).getDefaultValue();
        Asserts.assertEquals(si.getDefaultValue(), typeDefaultValue, "Wrong defaultValue");
    } catch (Exception e) {
        System.out.printf("SettingDescriptorInfo != SettingDescriptor=%s%nValueDescriptor=%s%n", si, d);
        throw e;
    }
}
 
Example #6
Source File: TestEventTypes.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void verifyMyEventType(List<EventTypeInfo> infos) {
    for (EventTypeInfo info : infos) {
        if ("MyEvent.name".equals(info.getName())) {
            System.out.println("EventTypeInfo for MyEvent: " + info);
            Asserts.assertEquals("MyEvent.label", info.getLabel());
            Asserts.assertEquals("MyEvent.description", info.getDescription());
            for (SettingDescriptorInfo si : info.getSettingDescriptors()) {
                System.out.println("si=" + si);
            }
            return;
        }
    }
    Asserts.fail("Missing EventTypeInfo for MyEvent");
}
 
Example #7
Source File: TestEventTypes.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void assertSame(EventTypeInfo ti, EventType t) {
    try {
        Asserts.assertEquals(ti.getId(), t.getId(), "Wrong id");
        Asserts.assertEquals(ti.getName(), t.getName(), "Wrong name");
        Asserts.assertEquals(ti.getLabel(), t.getLabel(), "Wrong label");
        Asserts.assertEquals(ti.getDescription(), t.getDescription(), "Wrong description");
        Asserts.assertEquals(ti.getCategoryNames(), t.getCategoryNames(), "Wrong category names");

        for (SettingDescriptorInfo si : ti.getSettingDescriptors()) {
            String settingName = si.getName();
            boolean isFound = false;
            for (SettingDescriptor d : t.getSettingDescriptors()) {
                if (settingName.equals(d.getName())) {
                    assertSame(si, d, t);
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                Asserts.fail("No ValueDescriptor for SettingDescriptorInfo: " + si);
            }
        }
    } catch (Exception e) {
        System.out.printf("EventTypeInfo != EventType%nEventTypeInfo=%s%nEventType=%s%n", ti, t);
        throw e;
    }
}
 
Example #8
Source File: TestEventTypes.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void assertSame(SettingDescriptorInfo si, SettingDescriptor d, EventType type) {
    try {
        Asserts.assertEquals(si.getName(), d.getName(), "Wrong name");
        Asserts.assertEquals(si.getLabel(), d.getLabel(), "Wrong label");
        Asserts.assertEquals(si.getTypeName(), d.getTypeName(), "Wrong typeName");
        Asserts.assertEquals(si.getDescription(), d.getDescription(), "Wrong description");
        String typeDefaultValue = Events.getSetting(type, si.getName()).getDefaultValue();
        Asserts.assertEquals(si.getDefaultValue(), typeDefaultValue, "Wrong defaultValue");
    } catch (Exception e) {
        System.out.printf("SettingDescriptorInfo != SettingDescriptor=%s%nValueDescriptor=%s%n", si, d);
        throw e;
    }
}
 
Example #9
Source File: TestEventTypes.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void verifyMyEventType(List<EventTypeInfo> infos) {
    for (EventTypeInfo info : infos) {
        if ("MyEvent.name".equals(info.getName())) {
            System.out.println("EventTypeInfo for MyEvent: " + info);
            Asserts.assertEquals("MyEvent.label", info.getLabel());
            Asserts.assertEquals("MyEvent.description", info.getDescription());
            for (SettingDescriptorInfo si : info.getSettingDescriptors()) {
                System.out.println("si=" + si);
            }
            return;
        }
    }
    Asserts.fail("Missing EventTypeInfo for MyEvent");
}
 
Example #10
Source File: TestEventTypes.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void assertSame(EventTypeInfo ti, EventType t) {
    try {
        Asserts.assertEquals(ti.getId(), t.getId(), "Wrong id");
        Asserts.assertEquals(ti.getName(), t.getName(), "Wrong name");
        Asserts.assertEquals(ti.getLabel(), t.getLabel(), "Wrong label");
        Asserts.assertEquals(ti.getDescription(), t.getDescription(), "Wrong description");
        Asserts.assertEquals(ti.getCategoryNames(), t.getCategoryNames(), "Wrong category names");

        for (SettingDescriptorInfo si : ti.getSettingDescriptors()) {
            String settingName = si.getName();
            boolean isFound = false;
            for (SettingDescriptor d : t.getSettingDescriptors()) {
                if (settingName.equals(d.getName())) {
                    assertSame(si, d, t);
                    isFound = true;
                    break;
                }
            }
            if (!isFound) {
                Asserts.fail("No ValueDescriptor for SettingDescriptorInfo: " + si);
            }
        }
    } catch (Exception e) {
        System.out.printf("EventTypeInfo != EventType%nEventTypeInfo=%s%nEventType=%s%n", ti, t);
        throw e;
    }
}
 
Example #11
Source File: TestEventTypes.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void assertSame(SettingDescriptorInfo si, SettingDescriptor d, EventType type) {
    try {
        Asserts.assertEquals(si.getName(), d.getName(), "Wrong name");
        Asserts.assertEquals(si.getLabel(), d.getLabel(), "Wrong label");
        Asserts.assertEquals(si.getTypeName(), d.getTypeName(), "Wrong typeName");
        Asserts.assertEquals(si.getDescription(), d.getDescription(), "Wrong description");
        String typeDefaultValue = Events.getSetting(type, si.getName()).getDefaultValue();
        Asserts.assertEquals(si.getDefaultValue(), typeDefaultValue, "Wrong defaultValue");
    } catch (Exception e) {
        System.out.printf("SettingDescriptorInfo != SettingDescriptor=%s%nValueDescriptor=%s%n", si, d);
        throw e;
    }
}