code: @SuppressWarnings("unchecked")
      public <T extends AsmMetric> AsmMetric register(String name, T metric) throws IllegalArgumentException {
          metric.setMetricName(name);
          final AsmMetric existing = metrics.putIfAbsent(name, metric);
          if (existing == null) {
              LOG.info("Successfully register metric of {}", name);
              return metric;
          } else {
              LOG.warn("duplicate metric: {}", name);
              return existing;
          }
      }
docs: Given a {@link com.alibaba.jstorm.common.metric.old.window.Metric}, registers it under the given name.
  
  @param name   the metric node
  @param metric the metric
  @param <T>    the type of the metric
  @return {@code metric}
  @throws IllegalArgumentException if the name is already registered