code: protected static <T extends GenericMetrics> List<T> getMetricsOfType(Class<T> type) {
          List<T> metricsList = (List<T>)registry.get(type);
          if (metricsList == null) {
              metricsList = new CopyOnWriteArrayList<>();
              List<T> previous = (List<T>)registry.putIfAbsent(type, metricsList);
              if (previous != null)
                  metricsList = previous;
          }
          return metricsList;
      }
docs: Get all registered metrics of given Class.
  @param type metrics of this class method should return.
  @param <T> class type.
  @return list of metrics of the desired type, or null if there are none.