Java 类org.springframework.boot.actuate.metrics.writer.CompositeMetricWriter 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:MetricCopyExporter.java   
private void flush(GaugeWriter writer) {
    if (writer instanceof CompositeMetricWriter) {
        for (MetricWriter child : (CompositeMetricWriter) writer) {
            flush(child);
        }
    }
    try {
        if (ClassUtils.isPresent("java.io.Flushable", null)) {
            if (writer instanceof Flushable) {
                ((Flushable) writer).flush();
                return;
            }
        }
        Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
        if (method != null) {
            ReflectionUtils.invokeMethod(method, writer);
        }
    }
    catch (Exception ex) {
        logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
                + ex.getMessage());
    }
}
项目:spring-boot-concourse    文件:MetricCopyExporter.java   
private void flush(GaugeWriter writer) {
    if (writer instanceof CompositeMetricWriter) {
        for (MetricWriter child : (CompositeMetricWriter) writer) {
            flush(child);
        }
    }
    try {
        if (ClassUtils.isPresent("java.io.Flushable", null)) {
            if (writer instanceof Flushable) {
                ((Flushable) writer).flush();
                return;
            }
        }
        Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
        if (method != null) {
            ReflectionUtils.invokeMethod(method, writer);
        }
    }
    catch (Exception ex) {
        logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
                + ex.getMessage());
    }
}
项目:contestparser    文件:MetricCopyExporter.java   
private void flush(MetricWriter writer) {
    if (writer instanceof CompositeMetricWriter) {
        for (MetricWriter child : (CompositeMetricWriter) writer) {
            flush(child);
        }
    }
    try {
        if (ClassUtils.isPresent("java.io.Flushable", null)) {
            if (writer instanceof Flushable) {
                ((Flushable) writer).flush();
                return;
            }
        }
        Method method = ReflectionUtils.findMethod(writer.getClass(), "flush");
        if (method != null) {
            ReflectionUtils.invokeMethod(method, writer);
        }
    }
    catch (Exception ex) {
        logger.warn("Could not flush MetricWriter: " + ex.getClass() + ": "
                + ex.getMessage());
    }
}
项目:kork    文件:SpectatorConfiguration.java   
@Bean
@Primary
@ConditionalOnMissingClass("org.springframework.messaging.MessageChannel")
@ConditionalOnMissingBean(name = "primaryMetricWriter")
public MetricWriter primaryMetricWriter(List<MetricWriter> writers) {
  return new CompositeMetricWriter(writers);
}
项目:spring-boot-starter-batch-web    文件:MetricsTestApplication.java   
@Bean(name = "primaryMetricWriter")
@Primary
static public MetricWriter primaryMetricWriter(List<MetricWriter> writers) {
    // Normally the Metrics are written asynchronously to Spring Boot's repository. In tests we need to do it synchronously to be able to verify
    // the correct output.
    MetricWriter compositeMetricWriter = new CompositeMetricWriter(writers);
    return compositeMetricWriter;
}