code: protected final T getStats(OnDemandStatsProducer producer, String name) {
          try {
              return getStatsClass().cast(producer.getStats(name));
          } catch (ClassCastException e) {
              LOGGER.error("getStats(): Unexpected stats type", e);
          } catch (OnDemandStatsProducerException e) {
              LOGGER.error("getStats(): Failed to get stats for name=" + name, e);
          }
  
          return null;
      }
docs: Returns stats for producer.
  
  @param producer {@link OnDemandStatsProducer}
  @param name stats name
  @return stats for producer