Class SolrMetricManager.GaugeWrapper<T>

java.lang.Object
org.apache.solr.metrics.SolrMetricManager.GaugeWrapper<T>
All Implemented Interfaces:
com.codahale.metrics.Gauge<T>, com.codahale.metrics.Metric
Enclosing class:
SolrMetricManager

public static class SolrMetricManager.GaugeWrapper<T> extends Object implements com.codahale.metrics.Gauge<T>
This is a wrapper for Gauge metrics, which are usually implemented as lambdas that often keep a reference to their parent instance. In order to make sure that all such metrics are removed when their parent instance is removed / closed the metric is associated with an instance tag, which can be used then to remove wrappers with the matching tag using SolrMetricManager.unregisterGauges(String, String).
  • Constructor Details

    • GaugeWrapper

      public GaugeWrapper(com.codahale.metrics.Gauge<T> gauge, String tag)
  • Method Details

    • getValue

      public T getValue()
      Specified by:
      getValue in interface com.codahale.metrics.Gauge<T>
    • getTag

      public String getTag()
    • getGauge

      public com.codahale.metrics.Gauge<T> getGauge()