lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject lucene-solr:feature/metrics: SOLR-4735 Simplify the code by using registryFor(String).
Date Wed, 30 Nov 2016 09:53:50 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/feature/metrics f027098b4 -> 7cedc4acb


SOLR-4735 Simplify the code by using registryFor(String).


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7cedc4ac
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7cedc4ac
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7cedc4ac

Branch: refs/heads/feature/metrics
Commit: 7cedc4acb26c23d11218037bfcad0737c3c566b6
Parents: f027098
Author: Andrzej Bialecki <ab@apache.org>
Authored: Wed Nov 30 10:53:25 2016 +0100
Committer: Andrzej Bialecki <ab@apache.org>
Committed: Wed Nov 30 10:53:25 2016 +0100

----------------------------------------------------------------------
 .../org/apache/solr/metrics/SolrMetricManager.java | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7cedc4ac/solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java b/solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java
index c3b7956..cfd135e 100644
--- a/solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java
+++ b/solr/core/src/java/org/apache/solr/metrics/SolrMetricManager.java
@@ -58,7 +58,7 @@ public class SolrMetricManager {
    * @param registry registry name
    */
   public static void clearRegistryFor(String registry) {
-    SharedMetricRegistries.getOrCreate(overridableRegistryName(registry)).removeMatching(MetricFilter.ALL);
+    registryFor(registry).removeMatching(MetricFilter.ALL);
   }
 
   /**
@@ -69,8 +69,7 @@ public class SolrMetricManager {
    * @param metricPath (optional) additional top-most metric name path elements
    */
   public static void clearMetric(String registry, String metricName, String... metricPath)
{
-    SharedMetricRegistries.getOrCreate(overridableRegistryName(registry)).
-        remove(mkName(metricName, metricPath));
+    registryFor(registry).remove(mkName(metricName, metricPath));
   }
 
   /**
@@ -82,8 +81,7 @@ public class SolrMetricManager {
    * @return existing or a newly created {@link Meter}
    */
   public static Meter getOrCreateMeter(String registry, String metricName, String... metricPath)
{
-    return SharedMetricRegistries.getOrCreate(overridableRegistryName(registry)).
-        meter(mkName(metricName, metricPath));
+    return registryFor(registry).meter(mkName(metricName, metricPath));
   }
 
   /**
@@ -95,8 +93,7 @@ public class SolrMetricManager {
    * @return existing or a newly created {@link Timer}
    */
   public static Timer getOrCreateTimer(String registry, String metricName, String... metricPath)
{
-    return SharedMetricRegistries.getOrCreate(overridableRegistryName(registry)).
-        timer(mkName(metricName, metricPath));
+    return registryFor(registry).timer(mkName(metricName, metricPath));
   }
 
   /**
@@ -108,8 +105,7 @@ public class SolrMetricManager {
    * @return existing or a newly created {@link Counter}
    */
   public static Counter getOrCreateCounter(String registry, String metricName, String...
metricPath) {
-    return SharedMetricRegistries.getOrCreate(overridableRegistryName(registry)).
-        counter(mkName(metricName, metricPath));
+    return registryFor(registry).counter(mkName(metricName, metricPath));
   }
 
   /**
@@ -121,8 +117,7 @@ public class SolrMetricManager {
    * @return existing or a newly created {@link Histogram}
    */
   public static Histogram getOrCreateHistogram(String registry, String metricName, String...
metricPath) {
-    return SharedMetricRegistries.getOrCreate(overridableRegistryName(registry)).
-        histogram(mkName(metricName, metricPath));
+    return registryFor(registry).histogram(mkName(metricName, metricPath));
   }
 
   /**


Mime
View raw message