Java 类io.vertx.core.spi.metrics.Metrics 实例源码

项目:vertx-spring    文件:AbstractDispatchingMetrics.java   
protected final <N extends Metrics> N createSubMetrics(
        Function<M, ? extends N> supplier,
        Function<List<? extends N>, ? extends N> dispatchingMetricsSupplier) {
    List<N> allSubMetrics = new ArrayList<>(delegates.size());
    for (M delegate : delegates) {
        N subMetrics = supplier.apply(delegate);
        if (subMetrics != null) {
            allSubMetrics.add(subMetrics);
        }
    }
    if (allSubMetrics.isEmpty()) {
        return null;
    } else if (allSubMetrics.size() == 1) {
        return allSubMetrics.get(0);
    } else {
        return dispatchingMetricsSupplier.apply(allSubMetrics);
    }
}
项目:vertx-dropwizard-metrics    文件:AbstractMetrics.java   
public static AbstractMetrics unwrap(Measured measured) {
  MetricsProvider provider = (MetricsProvider) measured;
  Metrics baseMetrics = provider.getMetrics();
  if (baseMetrics instanceof AbstractMetrics) {
    return (AbstractMetrics) baseMetrics;
  }
  return null;
}