Class MetricPoller

  extended by com.twitter.common.metrics.MetricPoller

public class MetricPoller
extends Object

A fixed-rate poller that triggers a MetricSampler.

Constructor Summary
MetricPoller(com.twitter.common.metrics.MetricSampler sampler, ScheduledExecutorService executor)
          Creates a new metric poller.
Method Summary
 void start(Amount<Long,Time> pollInterval)
          Initiates the poller.
 void stop()
          Stops the poller.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public MetricPoller(com.twitter.common.metrics.MetricSampler sampler,
                    ScheduledExecutorService executor)
Creates a new metric poller.

sampler - Sampler to fetch metric values from.
executor - Executor service to run the sampler with.
Method Detail


public void start(Amount<Long,Time> pollInterval)
Initiates the poller. The poller may only be started once. If an attempt is made to start a poller when it is already started, IllegalStateException will be thrown.

pollInterval - Fixed poll rate.


public void stop()
Stops the poller. If the poller is already stopped, or is in the process of being stopped, subsequent calls will throw IllegalStateException.