Java源码示例:jdk.jfr.internal.settings.EnabledSetting

示例1
private static Control defineEnabled(PlatformEventType type) {
    Enabled enabled = type.getAnnotation(Enabled.class);
    // Java events are enabled by default,
    // JVM events are not, maybe they should be? Would lower learning curve
    // there too.
    String def = type.isJVM() ? "false" : "true";
    if (enabled != null) {
        def = Boolean.toString(enabled.value());
    }
    type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_ENABLED, Enabled.NAME, def, Collections.emptyList()));
    return new EnabledSetting(type, def);
}
 
示例2
void disable() {
    for (Control c : eventControls.values()) {
        if (c instanceof EnabledSetting) {
            c.setValueSafe("false");
            return;
        }
    }
}
 
示例3
private static Control defineEnabled(PlatformEventType type) {
    Enabled enabled = type.getAnnotation(Enabled.class);
    // Java events are enabled by default,
    // JVM events are not, maybe they should be? Would lower learning curve
    // there too.
    String def = type.isJVM() ? "false" : "true";
    if (enabled != null) {
        def = Boolean.toString(enabled.value());
    }
    type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_ENABLED, Enabled.NAME, def, Collections.emptyList()));
    return new EnabledSetting(type, def);
}
 
示例4
void disable() {
    for (Control c : eventControls.values()) {
        if (c instanceof EnabledSetting) {
            c.setValueSafe("false");
            return;
        }
    }
}
 
示例5
private static Control defineEnabled(PlatformEventType type) {
    Enabled enabled = type.getAnnotation(Enabled.class);
    // Java events are enabled by default,
    // JVM events are not, maybe they should be? Would lower learning curve
    // there too.
    String def = type.isJVM() ? "false" : "true";
    if (enabled != null) {
        def = Boolean.toString(enabled.value());
    }
    type.add(PrivateAccess.getInstance().newSettingDescriptor(TYPE_ENABLED, Enabled.NAME, def, Collections.emptyList()));
    return new EnabledSetting(type, def);
}
 
示例6
void disable() {
    for (Control c : eventControls.values()) {
        if (c instanceof EnabledSetting) {
            c.setValueSafe("false");
            return;
        }
    }
}