code: @Override
    public synchronized <T extends com.codahale.metrics.Metric> T register(String name, T metric)
        throws IllegalArgumentException {
      if (!(metric instanceof ContextAwareMetric)) {
        throw new UnsupportedOperationException("Can only register ContextAwareMetrics");
      }
      if (this.contextAwareMetrics.putIfAbsent(name, ((ContextAwareMetric) metric).getInnerMetric()) != null) {
        throw new IllegalArgumentException("A metric named " + name + " already exists");
      }
      MetricContext metricContext = this.metricContext.get();
      if (metricContext != null) {
        metricContext.addToMetrics((ContextAwareMetric) metric);
      }
      // Also register the metric with the MetricRegistry using its fully-qualified name
      return metric;
    }
docs: Register a given metric under a given name.
  
  <p>
  This method does not support registering {@link com.codahale.metrics.MetricSet}s.
  See{@link #registerAll(com.codahale.metrics.MetricSet)}.
  </p>
  
  <p>
  This method will not register a metric with the same name in the parent context (if it exists).
  </p>