jdk.jfr.internal.management.ManagementSupport Java Examples

The following examples show how to use jdk.jfr.internal.management.ManagementSupport. 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: FlightRecorderMXBeanImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<EventTypeInfo> getEventTypes() {
    MBeanUtils.checkMonitor();
    List<EventType> eventTypes = AccessController.doPrivileged(new PrivilegedAction<List<EventType>>() {
        @Override
        public List<EventType> run() {
            return ManagementSupport.getEventTypes();
        }
    }, null, new FlightRecorderPermission("accessFlightRecorder"));

    return MBeanUtils.transformList(eventTypes, EventTypeInfo::new);
}
 
Example #4
Source File: FlightRecorderMXBeanImpl.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Map<String, String> getRecordingOptions(long recording) throws IllegalArgumentException {
    MBeanUtils.checkMonitor();
    Recording r = getExistingRecording(recording);
    Map<String, String> options = new HashMap<>(10);
    options.put(OPTION_DUMP_ON_EXIT, String.valueOf(r.getDumpOnExit()));
    options.put(OPTION_DISK, String.valueOf(r.isToDisk()));
    options.put(OPTION_NAME, String.valueOf(r.getName()));
    options.put(OPTION_MAX_AGE, ManagementSupport.formatTimespan(r.getMaxAge(), " "));
    Long maxSize = r.getMaxSize();
    options.put(OPTION_MAX_SIZE, String.valueOf(maxSize == null ? "0" : maxSize.toString()));
    options.put(OPTION_DURATION, ManagementSupport.formatTimespan(r.getDuration(), " "));
    return options;
}
 
Example #5
Source File: MBeanUtils.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static Duration duration(String s) throws NumberFormatException {
    if (s == null) {
        return null;
    }
    long l = ManagementSupport.parseTimespan(s);
    if (l == 0) {
        return null;
    }
    return Duration.ofNanos(l);
}
 
Example #6
Source File: FlightRecorderMXBeanImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<EventTypeInfo> getEventTypes() {
    MBeanUtils.checkMonitor();
    List<EventType> eventTypes = AccessController.doPrivileged(new PrivilegedAction<List<EventType>>() {
        @Override
        public List<EventType> run() {
            return ManagementSupport.getEventTypes();
        }
    }, null, new FlightRecorderPermission("accessFlightRecorder"));

    return MBeanUtils.transformList(eventTypes, EventTypeInfo::new);
}
 
Example #7
Source File: FlightRecorderMXBeanImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Map<String, String> getRecordingOptions(long recording) throws IllegalArgumentException {
    MBeanUtils.checkMonitor();
    Recording r = getExistingRecording(recording);
    Map<String, String> options = new HashMap<>(10);
    options.put(OPTION_DUMP_ON_EXIT, String.valueOf(r.getDumpOnExit()));
    options.put(OPTION_DISK, String.valueOf(r.isToDisk()));
    options.put(OPTION_NAME, String.valueOf(r.getName()));
    options.put(OPTION_MAX_AGE, ManagementSupport.formatTimespan(r.getMaxAge(), " "));
    Long maxSize = r.getMaxSize();
    options.put(OPTION_MAX_SIZE, String.valueOf(maxSize == null ? "0" : maxSize.toString()));
    options.put(OPTION_DURATION, ManagementSupport.formatTimespan(r.getDuration(), " "));
    return options;
}
 
Example #8
Source File: MBeanUtils.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static Duration duration(String s) throws NumberFormatException {
    if (s == null) {
        return null;
    }
    long l = ManagementSupport.parseTimespan(s);
    if (l == 0) {
        return null;
    }
    return Duration.ofNanos(l);
}
 
Example #9
Source File: FlightRecorderMXBeanImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public List<EventTypeInfo> getEventTypes() {
    MBeanUtils.checkMonitor();
    List<EventType> eventTypes = AccessController.doPrivileged(new PrivilegedAction<List<EventType>>() {
        @Override
        public List<EventType> run() {
            return ManagementSupport.getEventTypes();
        }
    }, null, new FlightRecorderPermission("accessFlightRecorder"));

    return MBeanUtils.transformList(eventTypes, EventTypeInfo::new);
}
 
Example #10
Source File: FlightRecorderMXBeanImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public Map<String, String> getRecordingOptions(long recording) throws IllegalArgumentException {
    MBeanUtils.checkMonitor();
    Recording r = getExistingRecording(recording);
    Map<String, String> options = new HashMap<>(10);
    options.put(OPTION_DUMP_ON_EXIT, String.valueOf(r.getDumpOnExit()));
    options.put(OPTION_DISK, String.valueOf(r.isToDisk()));
    options.put(OPTION_NAME, String.valueOf(r.getName()));
    options.put(OPTION_MAX_AGE, ManagementSupport.formatTimespan(r.getMaxAge(), " "));
    Long maxSize = r.getMaxSize();
    options.put(OPTION_MAX_SIZE, String.valueOf(maxSize == null ? "0" : maxSize.toString()));
    options.put(OPTION_DURATION, ManagementSupport.formatTimespan(r.getDuration(), " "));
    return options;
}
 
Example #11
Source File: MBeanUtils.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static Duration duration(String s) throws NumberFormatException {
    if (s == null) {
        return null;
    }
    long l = ManagementSupport.parseTimespan(s);
    if (l == 0) {
        return null;
    }
    return Duration.ofNanos(l);
}