You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I find that the private field metricsService at Line 36 in the file 'ninja/ninja-metrics/src/main/java/ninja/metrics/InstrumentedCache.java' on the develop branch is only assigned and used in the method InstrumentedCache. Therefore, this field can be removed from the class, and become a local variable in the method InstrumentedCache. Besides, for method init, the field metricsService can be converted to an input parameter.This transformation will normally reduce memory usage and improve readability of your code.I will be happy if this transformation is helpful.
privateMetricsServicemetricsService; // line 36 this field can be replaced by local variableInstrumentedCache(Cachecache, MetricsServicemetricsService) {
this.underlyingCache = cache;
// MetricsService metricsService = metricsService;this.metricsService = metricsService;
// init(metricsService);init();
}
// private void init(MetricsService metricsService)privatevoidinit() {
MetricRegistryregistry = metricsService.getMetricRegistry();
hitCounter = registry.counter("ninja.cache.hits");
missCounter = registry.counter("ninja.cache.miss");
}
The text was updated successfully, but these errors were encountered:
Hi,
I find that the private field metricsService at Line 36 in the file 'ninja/ninja-metrics/src/main/java/ninja/metrics/InstrumentedCache.java' on the develop branch is only assigned and used in the method InstrumentedCache. Therefore, this field can be removed from the class, and become a local variable in the method InstrumentedCache. Besides, for method init, the field metricsService can be converted to an input parameter.This transformation will normally reduce memory usage and improve readability of your code.I will be happy if this transformation is helpful.
The text was updated successfully, but these errors were encountered: