|
RuneHive-Game
|
The class that handles scheduling tasks, and processing them. More...
Public Member Functions | |
| void | cancel (Object attachment) |
Cancels a task that has a specific attachment. | |
| void | cancel (Object attachment, boolean logout) |
Cancels a task that has a specific attachment. | |
| List< Task > | getTasks () |
| synchronized void | processTasks () |
| This method handles adding new tasks and processing of active tasks. | |
| synchronized void | schedule (Task task) |
Schedules a Task to be ran in the future. | |
Private Attributes | |
| final List< Task > | active = new ArrayList<>() |
| The list of tasks that are currently running. | |
| final Queue< Task > | pending = new ConcurrentLinkedQueue<>() |
| The queue of tasks that are waiting to be executed. | |
Static Private Attributes | |
| static final Logger | logger = LogManager.getLogger(TaskManager.class) |
| The single logger for this class. | |
The class that handles scheduling tasks, and processing them.
Definition at line 18 of file TaskManager.java.
| void com.runehive.game.task.TaskManager.cancel | ( | Object | attachment | ) |
Cancels a task that has a specific attachment.
| attachment | The object that is attached to the task. |
Definition at line 109 of file TaskManager.java.
References cancel().
Referenced by cancel().
| void com.runehive.game.task.TaskManager.cancel | ( | Object | attachment, |
| boolean | logout ) |
Cancels a task that has a specific attachment.
| attachment | The object that is attached to the task. |
| logout | When the task gets canceled this flag determines if the player should logout. |
Definition at line 122 of file TaskManager.java.
References pending.
| List< Task > com.runehive.game.task.TaskManager.getTasks | ( | ) |
| synchronized void com.runehive.game.task.TaskManager.processTasks | ( | ) |
This method handles adding new tasks and processing of active tasks.
Definition at line 79 of file TaskManager.java.
| synchronized void com.runehive.game.task.TaskManager.schedule | ( | Task | task | ) |
Schedules a Task to be ran in the future.
| task | The task to schedule. |
Definition at line 44 of file TaskManager.java.
|
private |
The list of tasks that are currently running.
A ArrayList is used here for very fast iteration speed.
Definition at line 36 of file TaskManager.java.
Referenced by getTasks(), and processTasks().
|
staticprivate |
The single logger for this class.
Definition at line 23 of file TaskManager.java.
Referenced by processTasks(), and schedule().
|
private |
The queue of tasks that are waiting to be executed.
A ConcurrentLinkedQueue is used here so tasks can be added safely from multiple threads.
Definition at line 30 of file TaskManager.java.
Referenced by cancel(), processTasks(), and schedule().