class CPUMonitor {

    public double getCPULoadAverage() {
        if (osMBean == null) {
            return -1;
        }
        synchronized (monitor) {
            if (cpuData.isCacheValid()) {
                return cpuData.getValue();
            }
            double systemLoadAverage = osMBean.getSystemLoadAverage();
            int availableProcessors = osMBean.getAvailableProcessors();

            if (systemLoadAverage < 0) {
                cpuData.setValue(systemLoadAverage);
            } else {
                if (availableProcessors == 0) {
                    /* should never happen, but ... */
                    cpuData.setValue(-2);
                } else {
                    cpuData.setValue(systemLoadAverage / availableProcessors);
                }
            }
            StringBuilder sb = new StringBuilder();
            sb.append("CPU load average:").append(cpuData.getValue());
            sb.append(", system load average:").append(systemLoadAverage);
            sb.append(", available processors:").append(availableProcessors);

            cpuData.setAdditionalData(KEY_DESCRIPTION, sb.toString());

            double result = cpuData.getValue();
            LOG.trace("Checked cpu usage, value now:{}", result);
            return result;
        }
    }

      CPUMonitor(OperatingSystemMXBean osMBean, long cacheTimeInMilliseconds);

}