List of usage examples for org.springframework.scheduling TaskScheduler scheduleAtFixedRate
ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period);
From source file:com.netflix.genie.web.health.GenieCpuHealthIndicator.java
GenieCpuHealthIndicator(final double maxCpuLoadPercent, final int maxCpuLoadConsecutiveOccurrences, final OperatingSystemMXBean operatingSystemMXBean, final BasicDistributionSummary summaryCpuMetric, final TaskScheduler taskScheduler) { this.maxCpuLoadPercent = maxCpuLoadPercent; this.maxCpuLoadConsecutiveOccurrences = maxCpuLoadConsecutiveOccurrences; this.operatingSystemMXBean = operatingSystemMXBean; this.summaryCpuMetric = summaryCpuMetric; this.summaryCpuMetric.record((long) (operatingSystemMXBean.getSystemCpuLoad() * 100)); taskScheduler.scheduleAtFixedRate( () -> this.summaryCpuMetric.record((long) (operatingSystemMXBean.getSystemCpuLoad() * 100)), 5000); }