Give a name to the Timer for MetricUpdater

This commit is contained in:
RuscalWorld 2022-07-26 16:18:24 +03:00
parent 2f6fda00ed
commit 2b402382f8
No known key found for this signature in database
GPG key ID: 6FF416979DF2B416
2 changed files with 6 additions and 6 deletions

View file

@ -59,7 +59,7 @@ public class FabricExporter implements ModInitializer {
ServerLifecycleEvents.SERVER_STOPPING.register(server -> {
this.getHttpServer().close();
this.getMetricRegistry().getTimer().cancel();
this.getMetricRegistry().getMetricUpdaterTimer().cancel();
});
instance = this;

View file

@ -15,18 +15,18 @@ public class MetricRegistry {
private final FabricExporter exporter;
private final List<Metric> metrics = new ArrayList<>();
private final HashMap<String, Collector> customMetrics = new HashMap<>();
private final Timer timer;
private final Timer metricUpdaterTimer;
public MetricRegistry(FabricExporter exporter) {
this.exporter = exporter;
timer = new Timer();
metricUpdaterTimer = new Timer("Metric Updater Timer");
}
public void runUpdater() {
MainConfig config = this.getExporter().getConfig();
MetricUpdater metricUpdater = new MetricUpdater(this.getExporter());
this.getMetrics().forEach(metricUpdater::registerMetric);
this.getTimer().schedule(metricUpdater, 1000, config.getUpdateInterval());
this.getMetricUpdaterTimer().schedule(metricUpdater, 1000, config.getUpdateInterval());
}
public void registerDefault() {
@ -79,8 +79,8 @@ public class MetricRegistry {
return exporter;
}
public Timer getTimer() {
return timer;
public Timer getMetricUpdaterTimer() {
return metricUpdaterTimer;
}
public HashMap<String, Collector> getCustomMetrics() {