in src/main/java/org/apache/sling/commons/scheduler/impl/GaugesSupport.java [373:399]
private void unregisterGauges() {
final Map<String, ServiceRegistration> localGaugeRegistrations;
synchronized (gaugeRegistrations) {
localGaugeRegistrations = new HashMap<>(gaugeRegistrations);
gaugeRegistrations.clear();
}
final Map<String, TemporaryGauge> localTemporaryGauges;
synchronized (temporaryGauges) {
localTemporaryGauges = new HashMap<>(temporaryGauges);
}
final Iterator<Entry<String, ServiceRegistration>> it = localGaugeRegistrations.entrySet().iterator();
while (it.hasNext()) {
final Entry<String, ServiceRegistration> e = it.next();
logger.debug("unregisterGauges: unregistering gauge : " + e.getKey());
e.getValue().unregister();
}
for (TemporaryGauge tempGauge : localTemporaryGauges.values()) {
logger.debug("unregisterGauges: unregistering temporary gauge for slow job : " + tempGauge.gaugeName);
tempGauge.unregister();
}
for (String registeredGaugeName : registeredGaugeNameList) {
metricRegistry.remove(registeredGaugeName);
}
}