Give a name to the Timer for MetricUpdater
This commit is contained in:
parent
2f6fda00ed
commit
2b402382f8
2 changed files with 6 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue