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 -> {
|
ServerLifecycleEvents.SERVER_STOPPING.register(server -> {
|
||||||
this.getHttpServer().close();
|
this.getHttpServer().close();
|
||||||
this.getMetricRegistry().getTimer().cancel();
|
this.getMetricRegistry().getMetricUpdaterTimer().cancel();
|
||||||
});
|
});
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
|
|
@ -15,18 +15,18 @@ public class MetricRegistry {
|
||||||
private final FabricExporter exporter;
|
private final FabricExporter exporter;
|
||||||
private final List<Metric> metrics = new ArrayList<>();
|
private final List<Metric> metrics = new ArrayList<>();
|
||||||
private final HashMap<String, Collector> customMetrics = new HashMap<>();
|
private final HashMap<String, Collector> customMetrics = new HashMap<>();
|
||||||
private final Timer timer;
|
private final Timer metricUpdaterTimer;
|
||||||
|
|
||||||
public MetricRegistry(FabricExporter exporter) {
|
public MetricRegistry(FabricExporter exporter) {
|
||||||
this.exporter = exporter;
|
this.exporter = exporter;
|
||||||
timer = new Timer();
|
metricUpdaterTimer = new Timer("Metric Updater Timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void runUpdater() {
|
public void runUpdater() {
|
||||||
MainConfig config = this.getExporter().getConfig();
|
MainConfig config = this.getExporter().getConfig();
|
||||||
MetricUpdater metricUpdater = new MetricUpdater(this.getExporter());
|
MetricUpdater metricUpdater = new MetricUpdater(this.getExporter());
|
||||||
this.getMetrics().forEach(metricUpdater::registerMetric);
|
this.getMetrics().forEach(metricUpdater::registerMetric);
|
||||||
this.getTimer().schedule(metricUpdater, 1000, config.getUpdateInterval());
|
this.getMetricUpdaterTimer().schedule(metricUpdater, 1000, config.getUpdateInterval());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerDefault() {
|
public void registerDefault() {
|
||||||
|
@ -79,8 +79,8 @@ public class MetricRegistry {
|
||||||
return exporter;
|
return exporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Timer getTimer() {
|
public Timer getMetricUpdaterTimer() {
|
||||||
return timer;
|
return metricUpdaterTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Collector> getCustomMetrics() {
|
public HashMap<String, Collector> getCustomMetrics() {
|
||||||
|
|
Loading…
Reference in a new issue