private <T> T getMetric(String key, ConcurrentMap<String, T> map, NewMetric<T> factory) {
    return computeIfAbsent(map, key, () -> factory.newMetric(getClass(), key, scope));
  }
Get a metric for {@code key} from {@code map}, or create it with {@code factory}.
hbase-client/src/main/java/org/apache/hadoop/hbase/client/MetricsConnection.java