public final class PollScheduler
extends java.lang.Object
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.Modifier and Type | Method and Description |
---|---|
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.
|
public static PollScheduler getInstance()
public void addPoller(PollRunnable task, long delay, java.util.concurrent.TimeUnit timeUnit)
public void start()
public void start(java.util.concurrent.ScheduledExecutorService service)
public void stop()
public boolean isStarted()