in geronimo-metrics-extensions/geronimo-metrics-sigar/src/main/java/org/apache/geronimo/microprofile/metrics/extension/sigar/SigarRegistrar.java [58:85]
public synchronized void start() {
this.sigarImpl = new Sigar();
this.sigar = SigarProxyCache.newInstance(sigarImpl, Integer.getInteger("geronimo.metrics.sigar.cache", EXPIRE_DEFAULT));
refreshInterval = Long.getLong("geronimo.metrics.sigar.refreshInterval", TimeUnit.MINUTES.toMillis(5));
if (refreshInterval > 0) {
refreshThread = new Thread(() -> {
final long iterationDuration = 250;
final long iterations = refreshInterval / iterationDuration;
while (!stopped) {
for (long i = 0; i < iterations; i++) {
if (stopped) {
return;
}
try {
Thread.sleep(iterationDuration);
} catch (final InterruptedException e) {
Thread.currentThread().interrupt();
}
}
tick();
}
}, getClass().getName() + "-refresher-" + hashCode());
stopped = false;
refreshThread.start();
}
tick();
}