/**
   * Decrement a metric by name.
   *
   * @param name of the metric
   * @param factory to lazily create the metric if not null
   */
  public void decr(String name, MetricMutableFactory factory) {
    MetricMutable m = metricsMap.get(name);

    if (m != null) {
      if (m instanceof MetricMutableGauge<?>) {
        ((MetricMutableGauge<?>) m).decr();
      } else {
        throw new MetricsException("Unsupported decr() for metric " + name);
      }
    } else if (factory != null) {
      metricsMap.put(name, factory.newMetric(name));
      decr(name, null);
    } else {
      throw new MetricsException("Metric " + name + " doesn't exist");
    }
  }
 /**
  * Decrement a metric by name.
  *
  * @param name of the metric
  */
 public void decr(String name) {
   decr(name, mf);
 }