com.netflix.servo.publish
Class PollScheduler

java.lang.Object
  extended by com.netflix.servo.publish.PollScheduler

public final class PollScheduler
extends java.lang.Object

Basic scheduler for polling metrics and reporting them to observers. You can add PollRunnable objects but not remove them individually. If you stop the instance and then start it again all of the prior tasks will be thrown away.


Method Summary
 void addPoller(PollRunnable task, long delay, java.util.concurrent.TimeUnit timeUnit)
          Add a tasks to execute at a fixed rate based on the provided delay.
static PollScheduler getInstance()
          Return the instance of this scheduler.
 boolean isStarted()
          Returns true if this scheduler is currently started.
 void start()
          Start scheduling tasks with a default thread pool, sized based on the number of available processors.
 void start(java.util.concurrent.ScheduledExecutorService service)
          Start the poller with the given executor service.
 void stop()
          Stop the poller, shutting down the current executor service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static PollScheduler getInstance()
Return the instance of this scheduler.


addPoller

public void addPoller(PollRunnable task,
                      long delay,
                      java.util.concurrent.TimeUnit timeUnit)
Add a tasks to execute at a fixed rate based on the provided delay.


start

public void start()
Start scheduling tasks with a default thread pool, sized based on the number of available processors.


start

public void start(java.util.concurrent.ScheduledExecutorService service)
Start the poller with the given executor service.


stop

public void stop()
Stop the poller, shutting down the current executor service.


isStarted

public boolean isStarted()
Returns true if this scheduler is currently started.