From 2b402382f843dd877cc087ca9f2b7f5e496b27bf Mon Sep 17 00:00:00 2001 From: RuscalWorld Date: Tue, 26 Jul 2022 16:18:24 +0300 Subject: [PATCH] Give a name to the Timer for MetricUpdater --- .../ru/ruscalworld/fabricexporter/FabricExporter.java | 2 +- .../ru/ruscalworld/fabricexporter/MetricRegistry.java | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java b/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java index fb027d1..26c63e2 100644 --- a/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java +++ b/src/main/java/ru/ruscalworld/fabricexporter/FabricExporter.java @@ -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; diff --git a/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java b/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java index 0ed7dc6..24603aa 100644 --- a/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java +++ b/src/main/java/ru/ruscalworld/fabricexporter/MetricRegistry.java @@ -15,18 +15,18 @@ public class MetricRegistry { private final FabricExporter exporter; private final List metrics = new ArrayList<>(); private final HashMap 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 getCustomMetrics() {