com.espertech.esper.metrics.codahale_metrics.metrics.reporting
Class JmxReporter

java.lang.Object
  extended by com.espertech.esper.metrics.codahale_metrics.metrics.reporting.AbstractReporter
      extended by com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter
All Implemented Interfaces:
MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>, MetricsRegistryListener, java.util.EventListener

public class JmxReporter
extends AbstractReporter
implements MetricsRegistryListener, MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>

A reporter which exposes application metric as JMX MBeans.


Nested Class Summary
static interface JmxReporter.CounterMBean
           
static interface JmxReporter.GaugeMBean
           
static interface JmxReporter.HistogramMBean
           
static interface JmxReporter.MeterMBean
           
static interface JmxReporter.MetricMBean
           
static interface JmxReporter.TimerMBean
           
 
Constructor Summary
JmxReporter(MetricsRegistry registry)
          Creates a new JmxReporter for the given registry.
 
Method Summary
static JmxReporter getDefault()
          Returns the default instance of JmxReporter if it has been started.
 void onMetricAdded(MetricName name, Metric metric)
          Called when a metric has been added to the MetricsRegistry.
 void onMetricRemoved(MetricName name)
          Called when a metric has been removed from the MetricsRegistry.
 void processCounter(MetricName name, Counter counter, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
          Process the given counter.
 void processGauge(MetricName name, Gauge gauge, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
          Process the given gauge.
 void processHistogram(MetricName name, Histogram histogram, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
          Process the given histogram.
 void processMeter(MetricName name, Metered meter, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
          Process the given Metered instance.
 void processTimer(MetricName name, Timer timer, com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
          Process the given timer.
 void shutdown()
          Stops the reporter and closes any internal resources.
static void shutdownDefault()
          Stops the default instance of JmxReporter.
 void start()
          Starts the reporter.
static void startDefault(MetricsRegistry registry)
          Starts the default instance of JmxReporter.
 
Methods inherited from class com.espertech.esper.metrics.codahale_metrics.metrics.reporting.AbstractReporter
getMetricsRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmxReporter

public JmxReporter(MetricsRegistry registry)
Creates a new JmxReporter for the given registry.

Parameters:
registry - a MetricsRegistry
Method Detail

startDefault

public static void startDefault(MetricsRegistry registry)
Starts the default instance of JmxReporter.

Parameters:
registry - the MetricsRegistry to report from

getDefault

public static JmxReporter getDefault()
Returns the default instance of JmxReporter if it has been started.

Returns:
The default instance or null if the default is not used

shutdownDefault

public static void shutdownDefault()
Stops the default instance of JmxReporter.


onMetricAdded

public void onMetricAdded(MetricName name,
                          Metric metric)
Description copied from interface: MetricsRegistryListener
Called when a metric has been added to the MetricsRegistry.

Specified by:
onMetricAdded in interface MetricsRegistryListener
Parameters:
name - the name of the Metric
metric - the Metric

onMetricRemoved

public void onMetricRemoved(MetricName name)
Description copied from interface: MetricsRegistryListener
Called when a metric has been removed from the MetricsRegistry.

Specified by:
onMetricRemoved in interface MetricsRegistryListener
Parameters:
name - the name of the Metric

processMeter

public void processMeter(MetricName name,
                         Metered meter,
                         com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
                  throws java.lang.Exception
Description copied from interface: MetricProcessor
Process the given Metered instance.

Specified by:
processMeter in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
Parameters:
name - the name of the meter
meter - the meter
context - the context of the meter
Throws:
java.lang.Exception - if something goes wrong

processCounter

public void processCounter(MetricName name,
                           Counter counter,
                           com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
                    throws java.lang.Exception
Description copied from interface: MetricProcessor
Process the given counter.

Specified by:
processCounter in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
Parameters:
name - the name of the counter
counter - the counter
context - the context of the meter
Throws:
java.lang.Exception - if something goes wrong

processHistogram

public void processHistogram(MetricName name,
                             Histogram histogram,
                             com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
                      throws java.lang.Exception
Description copied from interface: MetricProcessor
Process the given histogram.

Specified by:
processHistogram in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
Parameters:
name - the name of the histogram
histogram - the histogram
context - the context of the meter
Throws:
java.lang.Exception - if something goes wrong

processTimer

public void processTimer(MetricName name,
                         Timer timer,
                         com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
                  throws java.lang.Exception
Description copied from interface: MetricProcessor
Process the given timer.

Specified by:
processTimer in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
Parameters:
name - the name of the timer
timer - the timer
context - the context of the meter
Throws:
java.lang.Exception - if something goes wrong

processGauge

public void processGauge(MetricName name,
                         Gauge gauge,
                         com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context context)
                  throws java.lang.Exception
Description copied from interface: MetricProcessor
Process the given gauge.

Specified by:
processGauge in interface MetricProcessor<com.espertech.esper.metrics.codahale_metrics.metrics.reporting.JmxReporter.Context>
Parameters:
name - the name of the gauge
gauge - the gauge
context - the context of the meter
Throws:
java.lang.Exception - if something goes wrong

shutdown

public void shutdown()
Description copied from class: AbstractReporter
Stops the reporter and closes any internal resources.

Overrides:
shutdown in class AbstractReporter

start

public final void start()
Starts the reporter.


© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com