public MutableFastCounter getCounter(String counterName, long potentialStartingValue) {
    // See getGauge for description on how this works.
    MutableMetric counter = metricsMap.get(counterName);
    if (counter == null) {
      MutableFastCounter newCounter =
        new MutableFastCounter(new MetricsInfoImpl(counterName, ""), potentialStartingValue);
      counter = metricsMap.putIfAbsent(counterName, newCounter);
      if (counter == null) {
        return newCounter;
      }
    }

    if (!(counter instanceof MutableCounter)) {
      throw new MetricsException("Metric already exists in registry for metric name: " + counterName
        + " and not of type MutableCounter");
    }

    return (MutableFastCounter) counter;
  }
Get a MetricMutableCounterLong from the storage. If it is not there atomically put it.
@param counterName            Name of the counter to get
@param potentialStartingValue starting value if we have to create a new counter
hbase-hadoop-compat/src/main/java/org/apache/hadoop/metrics2/lib/DynamicMetricsRegistry.java