JmxReporterConfig.java 文件源码

java
阅读 28 收藏 0 点赞 0 评论 0

项目:carbon-metrics 作者:
/**
 * Build the JMX Reporter
 *
 * @param metricRegistry The {@link MetricRegistry} for the reporter
 * @param metricFilter   The {@link MetricFilter} for the reporter
 * @return an {@link Optional} with {@link JmxReporter}, if the reporter is built successfully, otherwise an empty
 * {@code Optional}
 * @throws ReporterBuildException when there was a failure in constructing the reporter
 */
@Override
public Optional<JmxReporter> build(MetricRegistry metricRegistry, MetricFilter metricFilter)
        throws ReporterBuildException {
    if (!isEnabled()) {
        return Optional.empty();
    }
    if (domain == null || domain.trim().isEmpty()) {
        throw new ReporterBuildException("Domain is not specified for JMX Reporting.");
    }

    if (logger.isInfoEnabled()) {
        logger.info(String.format("Creating JMX reporter for Metrics with domain '%s'", domain));
    }

    return Optional.of(new JmxReporter(getName(), metricRegistry, getFilter(metricFilter), domain));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号