public interface Ticker
Modifier and Type | Method and Description |
---|---|
Executor |
getExecutor()
Get the underlying Executor.
|
void |
queueTimedJob(java.lang.Runnable job,
long offset)
Run a job after a given delay.
|
void |
queueTimedJob(java.lang.Runnable job,
java.lang.String name,
long offset,
boolean runOnTickerAnyway,
boolean noDupes)
Run a job after a given delay.
|
void |
queueTimedJobAbsolute(java.lang.Runnable runner,
java.lang.String name,
long time,
boolean runOnTickerAnyway,
boolean noDupes)
Run a job at a specified absolute time.
|
void |
removeQueuedJob(java.lang.Runnable job)
Remove a queued job.
|
void queueTimedJob(java.lang.Runnable job, long offset)
job
- The Runnable to execute.offset
- The delay in milliseconds.void queueTimedJob(java.lang.Runnable job, java.lang.String name, long offset, boolean runOnTickerAnyway, boolean noDupes)
job
- The Runnable to execute.name
- The name of the thread to run it.offset
- The delay in milliseconds.runOnTickerAnyway
- If true, start the job from the Ticker thread even if we could pass
it directly through to the Executor. This is needed for increasing thread priorities, since
the Ticker runs at a high priority, and for some tests.noDupes
- If true, ignore the job if it is already queued. Implies runOnTickerAnyway.
WARNING: This does not guarantee that we don't run multiple copies of the job
simultaneously! You must ensure adequate locking. Worse, if the job takes an unexpectedly
long time, you could end up with many copies of the job running simultaneously.Executor getExecutor()
void removeQueuedJob(java.lang.Runnable job)
void queueTimedJobAbsolute(java.lang.Runnable runner, java.lang.String name, long time, boolean runOnTickerAnyway, boolean noDupes)
job
- The Runnable to execute.name
- The name of the thread to run it.time
- The time at which to run the job.runOnTickerAnyway
- If true, start the job from the Ticker thread even if we could pass
it directly through to the Executor. This is needed for increasing thread priorities, since
the Ticker runs at a high priority, and for some tests.noDupes
- If true, ignore the job if it is already queued. Implies runOnTickerAnyway.
WARNING: This does not guarantee that we don't run multiple copies of the job
simultaneously! You must ensure adequate locking. Worse, if the job takes an unexpectedly
long time, you could end up with many copies of the job running simultaneously.