All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mapfish.print.metrics.JmxMetricsReporter Maven / Gradle / Ivy

There is a newer version: 3.22.0
Show newest version
package org.mapfish.print.metrics;

import com.codahale.metrics.JmxReporter;
import com.codahale.metrics.MetricRegistry;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * This bean will enable JMX reporting when added to application context.
 */
public final class JmxMetricsReporter {

    @Autowired
    private MetricRegistry metricRegistry;
    private JmxReporter reporter;

    /**
     * Add jmx reporter on startup.
     */
    @PostConstruct
    public void init() {
        this.reporter = JmxReporter.forRegistry(this.metricRegistry).build();
        this.reporter.start();
    }

    /**
     * Stop JMX reporter.
     */
    @PreDestroy
    public void destroy() {
        this.reporter.stop();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy