static MetricsConnection getMetricsConnection(final Configuration conf, final String scope,
    Supplier<ThreadPoolExecutor> batchPool, Supplier<ThreadPoolExecutor> metaPool) {
    return METRICS_INSTANCES.compute(scope, (s, metricsConnection) -> {
      if (metricsConnection == null) {
        MetricsConnection newMetricsConn = new MetricsConnection(conf, scope, batchPool, metaPool);
        newMetricsConn.incrConnectionCount();
        return newMetricsConn;
      } else {
        metricsConnection.addThreadPools(batchPool, metaPool);
        metricsConnection.incrConnectionCount();
        return metricsConnection;
      }
    });
  }
This class is for maintaining the various connection statistics and publishing them through the
metrics interfaces. This class manages its own {@link MetricRegistry} and {@link JmxReporter} so
as to not conflict with other uses of Yammer Metrics within the client application. Calling
{@link #getMetricsConnection(Configuration, String, Supplier, Supplier)} implicitly creates and
"starts" instances of these classes; be sure to call {@link #deleteMetricsConnection(String)} to
terminate the thread pools they allocate. The metrics reporter will be shutdown
{@link #shutdown()} when all connections within this metrics instances are closed.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java