java.lang.Runnable
public class TaskScheduler
extends java.lang.Object
implements java.lang.Runnable
TaskScheduler
uses a ThreadPool
to recurrent
execute SchedulerTask
s.Modifier and Type | Field | Description |
---|---|---|
protected long |
schedulerTimeout |
Constructor | Description |
---|---|
TaskScheduler(ThreadPool threadPool) |
Creates a
TaskScheduler that uses the supplied
ThreadPool to execute tasks. |
Modifier and Type | Method | Description |
---|---|---|
void |
addTask(SchedulerTask task) |
Adds a task to the scheduler.
|
void |
clear() |
Removes all tasks.
|
boolean |
isStop() |
Checks if the scheduler is (to be) stopped.
|
boolean |
removeTask(SchedulerTask task) |
Removes a task from the scheduler.
|
void |
run() |
Runs the scheduler.
|
void |
setStop(boolean stop) |
Stops the schedulers run method.
|
public TaskScheduler(ThreadPool threadPool)
TaskScheduler
that uses the supplied
ThreadPool
to execute tasks.threadPool
- a ThreadPool
.public void addTask(SchedulerTask task)
task
- a SchedulerTask
.public boolean removeTask(SchedulerTask task)
task
- the SchedulerTask
to be removed from the schedulertrue
if the task could be removed.public void clear()
public void run()
run
in interface java.lang.Runnable
public void setStop(boolean stop)
stop
- true
to stop the scheduler.public boolean isStop()
true
if the scheduler has been stopped or is being stopped.Copyright © 2018 SNMP4J.org. All rights reserved.